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

📄 tdofpz3x3.m

📁 MATLAB PROGRAMS FOR "VIBRATION SIMULATION USING MATLAB AND ANSYS" All the M-files which are liste
💻 M
字号:
	echo off
%	tdofpz3x3.m		plotting poles/zeros of tdof model, all 9 plots
%	Uses the "num/den" form of the transfer function, calculates and plots
%	all nine pole/zero combinations for the nine different transfer
%	functions for tdof model.  It prompts for values of the two dampers,
%	c1 and c2, where the default (hitting the "enter" key) values are set
%	to zero to match the hand calculated values in (2.82).  The "transfer
%	function" forms of the transfer functions are then converted to "zpk -
%	zero/pole/gain" form to enable graphical construction of frequency
%	response in the next chapter.	

	clf;

	clear all;

%	using Matlab's pzmap function with the "tf" form using num/den
%	to define the numerator and denominator terms of the different
%	transfer functionx

%	assign values for masses, damping, and stiffnesses

	m1 = 1;
	m2 = 1;
	m3 = 1;
	k1 = 1;
	k2 = 1;

%	prompt for c1 and c2 values, set to zero to match closed form solution

	c1 = input('enter value for damper c1, default is zero, ...  ');
	
	if  isempty(c1)
		c1 = 0;
	end			

	c2 = input('enter value for damper c2, default is zero, ...  ');
	
	if  isempty(c2)
		c2 = 0;
	end			

%	define row vectors of numerator and denominator coefficients

	den = [(m1*m2*m3) (m2*m3*c1 + m1*m3*c1 + m1*m2*c2 + m1*m3*c2) ...
	       (m1*m3*k1 + m1*m3*k2 + m1*m2*k2 + m2*c1*c2 + m3*c1*c2 + ...
	        m1*c1*c2 + k1*m2*m3) ...
		   (m3*c1*k2 + m2*c2*k1 + m1*c2*k1 + m1*c1*k2 + m3*c2*k1 + m2*c1*k2) ...
		   (m1*k1*k2 + m2*k1*k2 + m3*k1*k2) 0 0];

	z11num = [(m2*m3) (m3*c1 + m3*c2 + m2*c2) (c1*c2 + m2*k2 + m3*k1 + m3*k2) ...
			  (c1*k2 + c2*k1) (k1*k2)];

	z21num = [(m3*c1) (c1*c2 + m3*k1) (c1*k2 + c2*k1) (k1*k2)];

	z31num = [(c1*c2) (c1*k2 + c2*k1) (k1*k2)];

	z22num = [(m1*m3) (m1*c2 + m3*c1) (m1*k2 + c1*c2 + m3*k1) ...
			  (c1*k2 + c2*k1) (k1*k2)];

%	use the "tf" function to convert to define "transfer function" systems

	sysz11 = tf(z11num,den)

	sysz21 = tf(z21num,den)

	sysz31 = tf(z31num,den)

	sysz22 = tf(z22num,den)

%	use the "zpk" function to convert from transfer function to zero/pole/gain form

	zpkz11 = zpk(sysz11)

	zpkz21 = zpk(sysz21)

	zpkz31 = zpk(sysz31)

	zpkz22 = zpk(sysz22)

%	use the "pzmap" function to map the poles and zeros of each transfer function

	[p11,z11] = pzmap(sysz11);

	[p21,z21] = pzmap(sysz21);

	[p31,z31] = pzmap(sysz31);

	[p22,z22] = pzmap(sysz22);

	p11

	z11

	z21

	z31

	z22

%	plot z11 for later use

	subplot(1,1,1)
	plot(real(p11),imag(p11),'k*')
	hold on
	plot(real(z11),imag(z11),'ko')
	title('Poles and Zeros of z11')
	ylabel('Imag')
	axis([-2 2 -2 2])
	axis('square')
	grid
	hold off

	disp('execution paused to display figure, "enter" to continue'); pause

%	plot all 9 plots on a 3x3 grid

	subplot(3,3,1)
	plot(real(p11),imag(p11),'k*')
	hold on
	plot(real(z11),imag(z11),'ko')
	title('Poles and Zeros of z11')
	ylabel('Imag')
	axis([-2 2 -2 2])
	axis('square')
	grid
	hold off

	subplot(3,3,2)
	plot(real(p21),imag(p21),'k*')
	hold on
	plot(real(z21),imag(z21),'ko')
	title('Poles and Zeros of z12')
	ylabel('Imag')
	axis([-2 2 -2 2])
	axis('square')
	grid
	hold off

	subplot(3,3,3)
	plot(real(p31),imag(p31),'k*')
	hold on
	plot(real(z31),imag(z31),'ko')
	title('Poles and Zeros of z13')
	ylabel('Imag')
	axis([-2 2 -2 2])
	axis('square')
	grid
	hold off

	subplot(3,3,4)
	plot(real(p21),imag(p21),'k*')
	hold on
	plot(real(z21),imag(z21),'ko')
	title('Poles and Zeros of z21')
	ylabel('Imag')
	axis([-2 2 -2 2])
	axis('square')
	grid
	hold off

	subplot(3,3,5)
	plot(real(p22),imag(p22),'k*')
	hold on
	plot(real(z22),imag(z22),'ko')
	title('Poles and Zeros of z22')
	ylabel('Imag')
	axis([-2 2 -2 2])
	axis('square')
	grid
	hold off

	subplot(3,3,6)
	plot(real(p21),imag(p21),'k*')
	hold on
	plot(real(z21),imag(z21),'ko')
	title('Poles and Zeros of z23')
	ylabel('Imag')
	axis([-2 2 -2 2])
	axis('square')
	grid
	hold off

	subplot(3,3,7)
	plot(real(p31),imag(p31),'k*')
	hold on
	plot(real(z31),imag(z31),'ko')
	title('Poles and Zeros of z31')
	xlabel('Real')
	ylabel('Imag')
	axis([-2 2 -2 2])
	axis('square')
	grid
	hold off

	subplot(3,3,8)
	plot(real(p21),imag(p21),'k*')
	hold on
	plot(real(z21),imag(z21),'ko')
	title('Poles and Zeros of z32')
	xlabel('Real')
	ylabel('Imag')
	axis([-2 2 -2 2])
	axis('square')
	grid
	hold off

	subplot(3,3,9)
	plot(real(p11),imag(p11),'k*')
	hold on
	plot(real(z11),imag(z11),'ko')
	title('Poles and Zeros of z33')
	xlabel('Real')
	ylabel('Imag')
	axis([-2 2 -2 2])
	axis('square')
	grid
	hold off

	disp('execution paused to display figure, "enter" to continue'); pause

%	check for real axis values to set plot scale

	z11_realmax = max(abs(real(z11)));
	z21_realmax = max(abs(real(z21)));
	z31_realmax = max(abs(real(z31)));
	z22_realmax = max(abs(real(z22)));

	maxplot = max([z11_realmax z21_realmax z31_realmax z22_realmax]);
	
	if  maxplot > 2
	
		maxplot = ceil(maxplot);

	else

		maxplot = 2;
		
	end				

	z11_realmax = max(abs(real(z11)));
	subplot(1,1,1)

	plot(real(p11),imag(p11),'k*')
	hold on
	plot(real(z11),imag(z11),'ko')
	title('Poles and Zeros of z11, z33')
	ylabel('Imag')
	axis([-maxplot maxplot -maxplot maxplot])
	axis('square')
	grid
	hold off

	disp('execution paused to display figure, "enter" to continue'); pause

	plot(real(p21),imag(p21),'k*')
	hold on
	plot(real(z21),imag(z21),'ko')
	title('Poles and Zeros of z21, z12, z23, z32')
	ylabel('Imag')
	axis([-maxplot maxplot -maxplot maxplot])
	axis('square')
	grid
	hold off

	disp('execution paused to display figure, "enter" to continue'); pause

	plot(real(p31),imag(p31),'k*')
	hold on
	plot(real(z31),imag(z31),'ko')
	title('Poles and Zeros of z31, z13')
	xlabel('Real')
	ylabel('Imag')
	axis([-maxplot maxplot -maxplot maxplot])
	axis('square')
	grid
	hold off

	disp('execution paused to display figure, "enter" to continue'); pause

	plot(real(p22),imag(p22),'k*')
	hold on
	plot(real(z22),imag(z22),'ko')
	title('Poles and Zeros of z22')
	ylabel('Imag')
	axis([-maxplot maxplot -maxplot maxplot])
	axis('square')
	grid
	hold off

⌨️ 快捷键说明

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