![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1076720/image.jpeg)
I am trying to plot a figure with different value of a parameter but the graph is plotting on negative Y axis.
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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;
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1076605/image.jpeg)
9 commentaires
dpb
le 29 Juil 2022
Modifié(e) : dpb
le 29 Juil 2022
"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.
Réponses (0)
Voir également
Catégories
En savoir plus sur Line Plots dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!