Not showing all 5 plots

1 次查看(过去 30 天)
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);

采纳的回答

Ilham Hardy
Ilham Hardy 2012-4-27
Use command:
hold on
after the first plot command

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Graphics Object Properties 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by