Not showing all 5 plots

조회 수: 7 (최근 30일)
Corey Bullard
Corey Bullard 2012년 4월 27일
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