1. 先建一个函数文件myfunc.m
% myfunc.m
function ya=myfunc(L,pin)
pth=1;
alps=1;
alpp=1;
syms y;
exp=log(pin/pth-0.5*alpp*L-0.5*alpp/alps*log(10)/10*y)+0.5*alpp*L-0.5*alpp/alps*log(10)/10*y-log(pin/pth);
ya=double(solve(exp,'y'));
end
2. 然后运行如下代码:
clear;
lLen=10;pinLen=10;
l=linspace(5,10,lLen);
pin=linspace(5,10,pinLen);
[ll,ppin]=meshgrid(l,pin);
g=zeros(pinLen,lLen);
for i=1:pinLen
for j=1:lLen
g(i,j)=real(myfunc(l(j),pin(i)));
end
end
mesh(ll,ppin,g)
我懒得加注释,你应该能看懂吧?
有帮助请采纳╮(╯▽╰)╭