How to plot symbolic variable that has a polynomial ?

2 visualizaciones (últimos 30 días)
DIP
DIP el 1 de Mayo de 2017
Editada: DIP el 1 de Mayo de 2017
Hi all.
I have a code, i need to plot y vs the syms variable Lambda_avg as given in the last line. How do i plot so that i can check how to variable changes as a result of distance ?
clc;
syms x
L=1;F=96485;P=47000;
% Anode molar flow rate equation
a=(-(1.12*(x/L)^2 - 2.24*x/L+1.2)*(4.978*(x/L)^4 + 5.756*(x/L)^3-0.544*(x/L)^2 - 0.496*x/L+0.35)*1/F);
int (a);
% Cathode molar flow rate equation
c=(0.5+(1.12*(x/L)^2 - 2.24*x/L+1.2))*(-4.978*(x/L)^4 + 5.756*(x/L)^3 -0.544*(x/L)^2 - 0.496*x/L+0.35)*1/F;
int(c);
% Partial pressure of water at anode and cathode
PH2Oa=100000*a/(1.142*10e-7 + a);
PH2Oc=100000*c/(2.767*10e-7 + c);
% Water uptake at anode and cathode
Lambda_a=1.4089+11.263*(PH2Oa/P)-18.768*(PH2Oa/P)^2+16.209*(PH2Oa/P)^3;
Lambda_c=1.4089+11.263*(PH2Oc/P)-18.768*(PH2Oc/P)^2+16.209*(PH2Oc/P)^3;
Lambda_avg = mean(Lambda_a+Lambda_c);
%plotting the average intake as function of y
Y = linspace(0,1,1000);
plot(Y, subs(Lambda_avg, x, Y));

Respuesta aceptada

Walter Roberson
Walter Roberson el 1 de Mayo de 2017
Y = linspace(0,1,1000);
plot(Y, subs(Lambda_avg, y, Y));
Or, alternately, if you have a new enough MATLAB,
fplot(Lambda_avg, [0 1]);

Más respuestas (0)

Community Treasure Hunt

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

Start Hunting!

Translated by