How can I plot a curve with given x and y variables?

2 views (last 30 days)
Hello guys,
I have to plot a p-V Diagramm in thermodynamics. Its the isentropic compression from 1->2.
How can I do the curve? I got the straight line from this code.
p = linspace(p1, p2, ); p1=1 p2= 32
V=linspace(V1, V2, ); V1= 2176 V2= 181
plot([V], [p])
Is it possible to create a curve with this code? Or hould I use a funciton for the gradient? Maybe y = -K*(p/V) or p = @(T,V) m*R*T./V;
Best Regards Edi
  2 Comments
Mathieu NOE
Mathieu NOE on 25 Apr 2022
hello
the topic has been already addressed in this forum
you can expand this code by adding those lines :
figure
plot(Vv1, p(Tv1,Vv1), 'LineWidth',2)
hold on
plot(Vv1, p(Tv2,Vv1), 'LineWidth',2)
plot(Vv1(1)*[1 1], p([Tv1(1) Tv1(end)],[1 1]*Vv1(1)), '-g', 'LineWidth',2)
plot(Vv1(end)*[1 1], p([Tv2(1) Tv2(end)],[1 1]*Vv1(end)), '-g', 'LineWidth',2)
hold off
grid
xlabel('V')
ylabel('p')
axis([125 225 2.0 3.3])
legend('T(273 - 323)', 'T(323 - 373)')
Eduard Spomer
Eduard Spomer on 25 Apr 2022
Think you very much for your answer. I already saw this and i didnt get it but i try it Again now.

Sign in to comment.

Answers (0)

Categories

Find more on Thermodynamics and Heat Transfer in Help Center and File Exchange

Products


Release

R2021b

Community Treasure Hunt

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

Start Hunting!