clcclear allA1 = 0.015; %Excitation Amplitude
A2 = 0.035;A3 = 0.06;l_r = 0.617; %Wave length of the road
v = 0.04107647433; %Speed(m/s)
P = l_r/v; %Period
Om = 1/P*2*pi; %Forcing Frequency
%Om = %0.07m,2m,45m/s
%Om = 9.512/(2*pi);
k_l = 26400; %Linear stiffness
m = 483; %Mass
%d = -0.1; %Stretching condition
f_n = sqrt(k_l/m)/(2*pi); %Natural frequency
%%
fig = figure();ax = axes();hold(ax); % view([-53 33]);
grid onl_array = linspace(0.1,1,100); %Excitation Amplituded_array = linspace(-0.1,-1,100);T = 150;x0 = [0,0];xval = zeros([],1) ; yval = zeros([],1) ; for i=1:numel(l_array) for i=1:numel(d_array) l = l_array(i); d = d_array(i); k_s = -(k_l*(l-d))/(4*d); %Spring stiffness
f = @(t,x) [ x(2); ... -(2*k_s*(x(1)-(A1*sin(Om*t)+A2*sin(2*Om*t)+A3*sin(3*Om*t)))* ... (sqrt((l-d)^2 + (x(1)-(A1*sin(Om*t)+A2*sin(2*Om*t)+A3*sin(3*Om*t)))^2) - l))/ ... (m*(sqrt((l-d)^2 + (x(1)-(A1*sin(Om*t)+A2*sin(2*Om*t)+A3*sin(3*Om*t)))^2))) ]; [t, x] = ode45(f,[100,T],x0); Response_amp = (max(x(:,1)) - min(x(:,1)))/2;% xval(i) = Om/(2*pi) ;
xval(i) = l; yval(i) = Response_amp ; zval(i) = d; end % plot(Om, Response_amp, '.');
endplot3(xval,yval,zval) ; xlabel('length of spring (m)')ylabel('Response Amplitude (m)')zlabel('pretension (m)')set(gca,'FontSize',13)
Hi, all. I wish to plot 3d grpah (length of spring vs response amplitude vs pretension). If run this code, I still get 2d graph. How am I supposed to do?
Thank you for your time.
Best Answer