HELP! I need to plot my values from if statement, and cant figure out how
Mostrar comentarios más antiguos
if H < 1.5 %Pressure drop is less than 1.5 psi
D = (Qc.^0.381)/(19.17*(H./(Cr.*L))^0.206);
elseif H >= 1.5 %Pressure drop is greater than or equal to 1.5 psi
D = (Qc.^0.381)/(18.93*((P1a.^2-P2a.^2).*Y./Cr.*L)^0.206);
end
xx = linspace(0,2*Qc,1000);
fplot
this is the part of the function that does the calculation and I can't figure out how to plot the D vs. xx
6 comentarios
Rik
el 7 de Jun. de 2019
If they are the same size, you can use plot. If that is not the case, you will need to describe your variables in more detail.
ragheed idrees
el 7 de Jun. de 2019
ragheed idrees
el 7 de Jun. de 2019
Rik
el 7 de Jun. de 2019
I you want to add a marker at only a single point, it is easier to use hold on and a single point with the appropriate marker at the appropriate position.
ragheed idrees
el 7 de Jun. de 2019
Rik
el 8 de Jun. de 2019
Which of the 1000 point do you want to put a marker?
Respuestas (1)
Raghunandan V
el 7 de Jun. de 2019
0 votos
Hi,
Just a small correction in the code
if H < 1.5 %Pressure drop is less than 1.5 psi
D = (Qc.^0.381)/(19.17*(H./(Cr.*L))^0.206);
else %Pressure drop is greater than or equal to 1.5 psi
D = (Qc.^0.381)/(18.93*((P1a.^2-P2a.^2).*Y./Cr.*L)^0.206);
end
xx = linspace(0,2*Qc,1000);
plot(xx, D)
This is only possible if your xx and D are of same dimention
2 comentarios
ragheed idrees
el 7 de Jun. de 2019
Raghunandan V
el 10 de Jun. de 2019
Oh! Are all the inputs to calculate the value of D available?
Categorías
Más información sobre Line Plots en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!