Not showing all 5 plots

1 vue (au cours des 30 derniers jours)
Corey Bullard
Corey Bullard le 27 Avr 2012
There should be 5 similar plots in 5 windows (later I will put them in to a figure). There is only one.
Also I will make a loop.
Anyway, here's the business end of my program:
t = 0:.01:1;
l_value = l(1);
v1 = velocity( r, angular_velocity, t, l_value );
max_flow1 = max(v)*piston_area;
disp(['For l = ' num2str(l_value) ' the peak flow rate is ' num2str(max_flow1) ' in^3/sec' ]);
l_value = l(2);
v2 = velocity( r, angular_velocity, t, l_value );
max_flow1 = max(v)*piston_area;
disp(['For l = ' num2str(l_value) ' the peak flow rate is ' num2str(max_flow1) ' in^3/sec' ]);
l_value = l(3);
v3 = velocity( r, angular_velocity, t, l_value );
max_flow1 = max(v)*piston_area;
disp(['For l = ' num2str(l_value) ' the peak flow rate is ' num2str(max_flow1) ' in^3/sec' ]);
l_value = l(4);
v4 = velocity( r, angular_velocity, t, l_value );
max_flow1 = max(v)*piston_area;
disp(['For l = ' num2str(l_value) ' the peak flow rate is ' num2str(max_flow1) ' in^3/sec' ]);
l_value = l(5);
v5 = velocity( r, angular_velocity, t, l_value );
max_flow1 = max(v)*piston_area;
disp(['For l = ' num2str(l_value) ' the peak flow rate is ' num2str(max_flow1) ' in^3/sec' ]);
%plot the flows
plot(t,v1*piston_area, 'r:' );
plot(t,v2*piston_area, 'g:');
plot(t,v3*piston_area, 'g:');
plot(t,v4*piston_area, 'g:');
plot(t,v5*piston_area, 'g:');
If I add each plot statement to a separate figure, they look fine. However, I need them in one figure.
Here is my velocity function:
v = -r.*angular_velocity.*(sin(angular_velocity.*t) + r./(2*l_value).*sin(2.*angular_velocity.*t).*(1 - (r./l_value.*sin(angular_velocity.*t)).^2).^-0.5);

Réponse acceptée

Ilham Hardy
Ilham Hardy le 27 Avr 2012
Use command:
hold on
after the first plot command

Plus de réponses (0)

Catégories

En savoir plus sur Linear and Nonlinear Regression dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by