Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
NCTM or The Math Forum.


Edward
Posts:
3
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 halfsine 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*(j1))/T);%halfsine pulse else F(j)=0; end
end
for i=1:length(zeta), wd=sqrt(1zeta(i)^2)*wn; %damped natural frequency of oscillator n=[1:1:N]; g=(dT/(m*wd))*exp((n1)*zeta(i)*wn*dT).*sin((n1)*wd*dT);%discretetime impulse response c0=conv(F,g); %convolution sum c1=c0(1:N); ymax=max(c1); hold on plot3(T,ymax,zeta,'.'); end end



