First, I had to rearrange ‘polyadiabatic’ to get it to work, because in the version you posted, several statements were out of order.
This version works:
function dAdT = polyadiabatic(T,A)
dAdT = zeros(2,1);
ki = 2.019.*10.*exp(-13810./A(2));
kp = 1.009.*(10.^5).*exp(-3557./A(2));
A1 = 2.57-((5.05.*0.001).*A(2));
A2 = 9.56-((1.76.*0.01).*A(2));
A3 = -3.032+((7.85.*0.001).*A(2));
wp = 1-A(1);
rho = 845-(A(2)-353)+((200+(A(2)-353)).*wp);
ktc = 2.205.*(10.^7).*exp(-844./A(2)).*exp(-2.*((A1.*wp)+(A2.*(wp.^2))+(A3.*(wp.^3))));
Rp = (kp).*rho.*A(1).*((2.*ki.*((rho.*A(1).^3)))./ktc).^0.5;
Pv_s = exp(135.23395+((-9226.418).*(A(2).^(-1)))+((-17.99862).*log(A(2)))+(0.01669633.*A(2)));
deltaH = -6.7.*(10.^5);
cp = 1.884.*1000;
dAdT(1) = -(Rp./rho);
dAdT(2) = -(Rp.*deltaH)./(cp.*rho);
end
Second, you need to calculate ‘Pv_s’ in ‘call_polyadiabatic’ in order to plot it. Add it (with a minor edit to use the second column of ‘A’) just after your ode15s call:
[T,A] = ode15s(@polyadiabatic,tspan,[A1_0 A2_0]);
Pv_s = exp(135.23395+((-9226.418).*(A(:,2).^(-1)))+((-17.99862).*log(A(:,2)))+(0.01669633.*A(:,2)));
Then the plot works.
Also, it might be more efficient to replace:
exp(135.23395+((-9226.418).*(A(2).^(-1)))
with:
exp(135.23395+((-9226.418)./A(2))
I will let you experiment with that.
5 Comments
Direct link to this comment
https://in.mathworks.com/matlabcentral/answers/413163-the-graph-is-not-showing-up-even-though-the-ode-solver-is-working#comment_604907
Direct link to this comment
https://in.mathworks.com/matlabcentral/answers/413163-the-graph-is-not-showing-up-even-though-the-ode-solver-is-working#comment_604907
Direct link to this comment
https://in.mathworks.com/matlabcentral/answers/413163-the-graph-is-not-showing-up-even-though-the-ode-solver-is-working#comment_604909
Direct link to this comment
https://in.mathworks.com/matlabcentral/answers/413163-the-graph-is-not-showing-up-even-though-the-ode-solver-is-working#comment_604909
Direct link to this comment
https://in.mathworks.com/matlabcentral/answers/413163-the-graph-is-not-showing-up-even-though-the-ode-solver-is-working#comment_604923
Direct link to this comment
https://in.mathworks.com/matlabcentral/answers/413163-the-graph-is-not-showing-up-even-though-the-ode-solver-is-working#comment_604923
Direct link to this comment
https://in.mathworks.com/matlabcentral/answers/413163-the-graph-is-not-showing-up-even-though-the-ode-solver-is-working#comment_604924
Direct link to this comment
https://in.mathworks.com/matlabcentral/answers/413163-the-graph-is-not-showing-up-even-though-the-ode-solver-is-working#comment_604924
Direct link to this comment
https://in.mathworks.com/matlabcentral/answers/413163-the-graph-is-not-showing-up-even-though-the-ode-solver-is-working#comment_604944
Direct link to this comment
https://in.mathworks.com/matlabcentral/answers/413163-the-graph-is-not-showing-up-even-though-the-ode-solver-is-working#comment_604944
Sign in to comment.