我想在 Matlab 中绘制这个函数:
F(p)=((3/2)*(7.02^2))-(2*18*p((1-(p/18))*(1-(exp(-18/p))))
我试图按照此Mathworks 页面中的描述制作情节。我写了这个:
p=0.001:0.001:10;
F=(((3/2)*(7.02^2))-(2*18*p((1-(p/18))*(1-(exp(-18/p)))));
plot(p,y)
但我得到一个错误:
??? F=(((3/2)*(7.02^2))-(2*18*p((1-(p/18))*(1-(exp(-18/p)))));
|
Error: Unbalanced or unexpected parenthesis or bracket.
我也尝试过这样的循环:
p=0.01:0.01:10;
F=zeros(1,length(p))
for i = 1:1000
F(i)=(((3/2)*(7.02^2))-(2*18*p(i)((1-(p(i)/18))*(1-(exp(-18/p(i))))));
end
plot(p,y)
但我得到了错误:
??? F=(((3/2)*(7.02^2))-(2*18*p((1-(p/18))*(1-(exp(-18/p)))));
|
Error: Unbalanced or unexpected parenthesis or bracket.
??? Error: File: Untitled2.m Line: 4 Column: 70
Unbalanced or unexpected parenthesis or bracket.
我不明白问题出在哪里...