Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: 'Plot3' command won't plot 3D
Replies: 1   Last Post: Apr 25, 2014 4:16 PM

 Messages: [ Previous | Next ]
 Edward Posts: 5 Registered: 4/3/14
'Plot3' command won't plot 3D
Posted: Apr 3, 2014 1:04 PM

hi,

I am currently trying to plot a 3d graph of the maximum responses for a system excited by a half-sine pulse for different values of zeta. The plot works in 2D but I would like to plot it in 3D with the x axis as the time period ratio T/tau, the y axis as maximum response ymax and the z axis as zeta. Here is my current script:

clear all

m=1;%mass
F0=1;
wn=1;%natural period of oscillator
for T=0:0.1:20 %period of pulse
T;
tau=(2*pi)/wn; %natural period of oscillator
zeta=[0 1 2 3 4 5]; %damping factor
dT=0.01; %sampling period
N=3000; %number of samples

for j=1:N,
if j<=T/dT+1;F(j)=F0*sin((dT*pi*(j-1))/T);%halfsine pulse
else F(j)=0;
end

end

for i=1:length(zeta),
wd=sqrt(1-zeta(i)^2)*wn; %damped natural frequency of oscillator
n=[1:1:N];
g=(dT/(m*wd))*exp(-(n-1)*zeta(i)*wn*dT).*sin((n-1)*wd*dT);%discrete-time impulse response
c0=conv(F,g); %convolution sum
c1=c0(1:N);
ymax=max(c1);

hold on

plot3(T,ymax,zeta,'.');

end
end

Date Subject Author
4/3/14 Edward
4/25/14 Roberto