I am trying to plot a figure with different value of a parameter but the graph is plotting on negative Y axis.

1 次查看(过去 30 天)
I am trying to plot a figure with different value of 'a' but when I am entering value of 'a' below 0.5, the graph is plotting on negative axis. As the equation I am plotting is effective capapcity equation, it can't be negative. Same is happening when I am plotting 'fun'.
I have attached the figure for reference.
function y = difference(u,d1,n,a,m,T,PsByN_0,UmaxN_0)
d1=20;
n=10^-11.4;
ne=0.5;
m=2.7;
a=0.40;
T=1;
PsByN_0dB=15;
PsByN_0=10.^(PsByN_0dB/10);
UmaxdB = 15;
UmaxN_0=10.^(UmaxdB/10);
%u = 0.01678
u=0.001:0.001:0.5;
fun1 = @(u) (1./u).*log(((d1^m)./(a.*ne.*PsByN_0.*T.*u+d1^m).*a)./(1-a));
fun2 = @(u) (1./u).*log(((-exp(u.*UmaxN_0).*(exp(-PsByN_0.*u)))./(u.*UmaxN_0+PsByN_0.*u)).*(PsByN_0.*u)-(PsByN_0.*u.*(exp(-PsByN_0.*u))).*(expint(u.*UmaxN_0+PsByN_0.*u))+(exp(-PsByN_0.*u))+((PsByN_0.*u).*(exp(-PsByN_0.*u))).*(expint(PsByN_0.*u))+(exp(u.*UmaxN_0))./((UmaxN_0/PsByN_0)+1))
fun = @(u) (fun1(u) - fun2(u));
%g0=fzero(fun,[0.001, 0.02])
g0 = fzero(fun,[0.01])
fun1(g0)
fun2(g0)
plot(u,fun1(u));
hold on;
grid on;
  9 个评论
dpb
dpb 2022-7-29
编辑:dpb 2022-7-29
"Both might be incorrect, but at least fun2 is incorrect."
It's also possible both are correct but the hypothesis they intersect is wrong -- or one or more of the other constants is/are wrong to shift the solution for fnA() above to be >0 such that fun1() is also positive.
Or, they could be the correct solution to the wrong problem; or there are incorrect assumptions (or at least unfulfilled/inconsistent with) in the formulation of the problem itself.
We've no knowledge of the problem; no way to judge the applicability of the solution/methods and even if work through the math, certainly no idea of particular constants.

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Line Plots 的更多信息

标签

产品


版本

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by