Plot a 2d figure for a complicated function
显示 更早的评论
Hi. I wanted to plot a 2d figure for the equation below (lambda) that are a function of c, but it doesn't give me any figures. Could you please tell me what is my problem? Thanks in advance for any help
vplc=0.25;delta=2.5;tau_max=44000;Ktau=0.045;%tauP=0.027;
kc=0.1; kh=0.05;Vp=0.9;Kbar=0.000015;kp=0.15;gamma=5.5;kb=0.4;
Vpm=0.000159;Kpm=0.15;alpha0=.00000681;alpha1=0.0000227;Ke=7;vs=0.002;ks=0.1;
Kf=0.18;kplc=0.055;ki=2;gamma=5.5;kipr=0.18;
[c]=meshgrid(0.001:0.005:1);
%[c]=meshgrid(0.002:0.005:1);
%c=0.07362169;h=0.5823305;ce=16.64219;p=0;
p=(vplc./ki).*(c.^2./((kplc).^2+c.^2));
h=kh.^4./(c.^4+kh.^4);
Po=(p.^2.*c.^4.*h)./(p.^2.*(1+kb).*c.^4.*h+kb.*kp.^2.*(kc.^2+c.^4));
A=(4.*c.^3.*p.^2.*h.*(p.^2.*(1+kb).*c.^4.*h+kb.*kp.^2.*(kc.^4+c.^4))-p.^4.*c.^8.*h.*(1+kb))./(p.^2.*(1+kb).*c.^4.*h+kb.*kp.^2.*(kc.^2+c.^4)).^2;
B=(4.*c.^3.*p.^2.*h.*(p.^2.*(1+kb).*c.^4.*h+kb.*kp.^2.*(kc.^4+c.^4))-p.^2.*c.^4.*h.*(4.*c.^3.*p.^2.*h.*(1+kb)+4.*c.^3.*kb.*kp.^2))./(p.^2.*(1+kb).*c.^4.*h+kb.*kp.^2.*(kc.^2+c.^4)).^2;
T=kipr.*A.*((vs.*c.^2./(c.^2+ks.^2)).*(1./kipr.*Po))-kipr.*Po.*(1+gamma)-((2.*c.*vs.*(c.^2+ks.^2)-2.*vs.*c.^3)./(c.^2+ks.^2).^2)-c.^4.*(1./tau_max);
D=(kipr.*A.*((vs.*c.^2./(c.^2+ks.^2)).*(1./kipr.*Po))-kipr.*Po.*(1+gamma)-((2.*c.*vs.*(c.^2+ks.^2)-2.*vs.*c.^3)./(c.^2+ks.^2).^2)).*(-c.^4.*(1./tau_max))-((kipr.*B.*((vs.*c.^2./(c.^2+ks.^2)).*(1./kipr.*Po))).*(c.^4.*(1./tau_max).*((-4.*c.^3.*kh.^4)./(c.^4+kh.^4).^2)));
lambda=(T+sqrt(T.^2-4.*D))./2;
plot(c,lambda)
hold on
采纳的回答
更多回答(1 个)
vplc=0.25;delta=2.5;tau_max=44000;Ktau=0.045;%tauP=0.027;
kc=0.1; kh=0.05;Vp=0.9;Kbar=0.000015;kp=0.15;gamma=5.5;kb=0.4;
Vpm=0.000159;Kpm=0.15;alpha0=.00000681;alpha1=0.0000227;Ke=7;vs=0.002;ks=0.1;
Kf=0.18;kplc=0.055;ki=2;gamma=5.5;kipr=0.18;
% grid
x = 0.001:0.005:1;
y = 0.001:0.005:1;
[c]=meshgrid(x, y);
%[c]=meshgrid(0.002:0.005:1);
%c=0.07362169;h=0.5823305;ce=16.64219;p=0;
p=(vplc./ki).*(c.^2./((kplc).^2+c.^2));
h=kh.^4./(c.^4+kh.^4);
Po=(p.^2.*c.^4.*h)./(p.^2.*(1+kb).*c.^4.*h+kb.*kp.^2.*(kc.^2+c.^4));
A=(4.*c.^3.*p.^2.*h.*(p.^2.*(1+kb).*c.^4.*h+kb.*kp.^2.*(kc.^4+c.^4))-p.^4.*c.^8.*h.*(1+kb))./(p.^2.*(1+kb).*c.^4.*h+kb.*kp.^2.*(kc.^2+c.^4)).^2;
B=(4.*c.^3.*p.^2.*h.*(p.^2.*(1+kb).*c.^4.*h+kb.*kp.^2.*(kc.^4+c.^4))-p.^2.*c.^4.*h.*(4.*c.^3.*p.^2.*h.*(1+kb)+4.*c.^3.*kb.*kp.^2))./(p.^2.*(1+kb).*c.^4.*h+kb.*kp.^2.*(kc.^2+c.^4)).^2;
T=kipr.*A.*((vs.*c.^2./(c.^2+ks.^2)).*(1./kipr.*Po))-kipr.*Po.*(1+gamma)-((2.*c.*vs.*(c.^2+ks.^2)-2.*vs.*c.^3)./(c.^2+ks.^2).^2)-c.^4.*(1./tau_max);
D=(kipr.*A.*((vs.*c.^2./(c.^2+ks.^2)).*(1./kipr.*Po))-kipr.*Po.*(1+gamma)-((2.*c.*vs.*(c.^2+ks.^2)-2.*vs.*c.^3)./(c.^2+ks.^2).^2)).*(-c.^4.*(1./tau_max))-((kipr.*B.*((vs.*c.^2./(c.^2+ks.^2)).*(1./kipr.*Po))).*(c.^4.*(1./tau_max).*((-4.*c.^3.*kh.^4)./(c.^4+kh.^4).^2)));
lambda=(T+sqrt(T.^2-4.*D))./2;
%whos
% This is a 3d plot rather than 2d plot
%plot(c,lambda)
surf(x, y, lambda, 'EdgeColor', 'none')
hold on
类别
在 帮助中心 和 File Exchange 中查找有关 Creating, Deleting, and Querying Graphics Objects 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!



