⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ext56uz.m

📁 vibration simulation using ansys and matlab 一书中的程序
💻 M
字号:
echo off
%	ext56uz.m		extraction of uz dof only
%	10-13-00

	clear all;

%	bring up a window with the file names of defined extension to choose from

	filename=uigetfile('*.eig','Select Input file from list')

	fid = fopen(filename,'rt');  %% Open in read mode as text.


	if fid == -1
	   	
	   	error('Error opening the file')

	end

	
	while 1
	
	   	nextline = fgetl(fid);   									% 	read a line
	   	
	   	if ~isstr(nextline), break, end  							% 	end of the file
	   
	   	if ext56chk(nextline, ' LOAD STEP=') & ext56chk(nextline, 'SUBSTEP=') 

	      	if ~ext56chk(nextline, 'CUM')	%	skips first LOAD STEP= and SUBSTEP=

	         	disp(nextline);

	         	a = sscanf(nextline, ' LOAD STEP= %f  SUBSTEP= %f ');

	         	mode_num = a(2);

	      	end

	   	end
	  
	   	if ext56chk(nextline, 'FREQ=')

	      	disp(nextline);

	      	%                     v--- the leading space below the "v" is important or won't work
	      	b = sscanf(nextline, ' FREQ= %f LOAD CASE= %f');

	      	freqin(mode_num) = b(1);

	   	end

% 	numbers in the array, so sscanf returns a vector
	   
	   	if ext56chk(nextline, 'ROTZ')

	      	array = [];

			numdof = 0;

	      	while 1

	         	nextline = fgetl(fid);

	         	c = sscanf(nextline, ' %f');

	         	if isempty(c), break, end
	         
	         	array = [array, c];

	     	end
	
			eva(:,:,mode_num) = array';
	
		end  
	
	end
	
	eva(:,:,mode_num) = array';
	
	fclose(fid);
	

%	reorder results in stacked vector form, with each mode represented by its frequency and
%	then its eigenvector
	
%	eva(:,1,1) is node number
%	eva(:,2,1) is ux dof column
%	eva(:,3,1) is uy dof column
%	eva(:,4,1) is uz dof column
%	eva(:,5,1) is rotx dof column
%	eva(:,6,1) is roty dof column
%	eva(:,7,1) is rotz dof column

%	include the appropriate eva values in the frequency/eigenvector vector as below

%	ev(:,1) = [freqin(1)			%	frequency of mode 1
%				eva(:,3,1)			%   uy dof included
%				eva(:,4,1)];		%   uz dof included
%				
%	for  cnt = 2:mode_num
%	
%		ev = 	   [ev(:,1)
%					freqin(cnt)		%	frequency of mode cnt
%					eva(:,3,cnt)	%   uy dof included
%					eva(:,4,cnt)];	%   uz dof included
%					
%	end				


%	for this model, include uz dof only

	ev(:,1) = [freqin(1)			%	frequency of mode 1
				eva(:,4,1)];		%   uz dof included

	[numrows,numcols] = size(ev(:,1));
				
	numdof = numrows - 1;

	for  cnt = 2:mode_num
	
		ev = 	   [ev(:,1)
					freqin(cnt)		%	frequency of mode cnt
					eva(:,4,cnt)];	%   uz dof included
					
	end				

%	convert to vector of frequencies, freqvec, and matrix of eigenvectors, evr
	
   	nmodes = length(ev)/numrows;

   	evr = reshape(ev,numrows,nmodes);

   	freqvec = evr(1,:)'

	node_numbers = eva(:,1,1)

   	evr = evr(2:numdof+1,:);

	save  ext56_uz  node_numbers  freqvec  evr	
	
	
	
	
	
	
	
	

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -