How do I plot a function up to a certain value and start another function at that value for the same plot?
Show older comments
I'm plotting the power on a hydraulic cylinder over the angle of tilt of the beam that the cylinder is pushing. This is the code I have, and for the plot I want the "red line" to stop at a value of 2, and the "blue line" to start at the value of 2. How do I go about this?
Also, is it possible to connect both lines to represent a drop in power?
This is code:
%Calculations for tilting ONLY
AC=2.125;
Fc=8130.0375;
BD=2;
A=0.03^2.*pi;
%Varying angles
a = 0:45;
Deg=sind(a);
FhN=2.125*Fc*Deg;
Fh=FhN/(BD*2*sind(10));
Ph=(Fh/A)/100000;
P_max=Fh*0.237;
P_rest=Fh*0.147;
% Power on Cylinder for Tilting
figure(1)
subplot(2,2,3)
plot(a,P_max,'r',a,P_rest,'b')
title('Power on HC')
axis([0 inf, 0 inf])
xlabel('Angle')
ylabel('Power [W]')
Accepted Answer
More Answers (0)
Categories
Find more on Introduction to Installation and Licensing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!