HELP! I need to plot my values from if statement, and cant figure out how

조회 수: 2 (최근 30일)
ragheed idrees
ragheed idrees 2019년 6월 7일
댓글: Raghunandan V 2019년 6월 10일
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
ragheed idrees
ragheed idrees 2019년 6월 7일
I see, my dilemma is that for me to plot it i need a for loop, but to get the correct asnwer (point on plot) I only get it without the for loop, how do I plot the graph and at the same time find the value without the for loop?
Rik
Rik 2019년 6월 8일
Which of the 1000 point do you want to put a marker?

댓글을 달려면 로그인하십시오.

답변 (1개)

Raghunandan V
Raghunandan V 2019년 6월 7일
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
ragheed idrees
ragheed idrees 2019년 6월 7일
thank you sir, I have done that but now i cant find the value for D in order to point it on the plot. Can you please help me with that?
Raghunandan V
Raghunandan V 2019년 6월 10일
Oh! Are all the inputs to calculate the value of D available?

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

제품


릴리스

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by