How to use vector value in equation?

1 次查看(过去 30 天)
I am trying to use value of g0 from (a) to (b), can anyone please correct me...
d1=20;
n=10^-11.4;
ne=0.5;
m=2.7;
a=0.01:0.01:0.5;
T=1;
PsByN_0dB=5;
PsByN_0=10.^(PsByN_0dB/10);
UmaxdB = 5;
UmaxN_0=10.^(UmaxdB/10);
fun1 = @(u,a) (-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,a) (fun1(u,a) - fun2(u));
options = optimset('Display','none');
g0 = arrayfun(@(a)fsolve(@(u)fun(u,a),[0.01],options),a); %a
d0 = @(g0,a) (-1./g0).*log(((d1^m)./(a.*ne.*PsByN_0.*T.*g0+d1^m).*a)./(1-a)); %b

采纳的回答

Torsten
Torsten 2022-8-10
You mean
d0 = fun1(g0,a)
?
  19 个评论
Torsten
Torsten 2022-8-17
You vary "a" and you vary "PsByN_0dB".
So you get a matrix of dimension
numel(a) x numel(PsByN_0dB)
as result for Pout.
Thus you can plot Pout with respect to the variation of "a" with "PsByN_0dB" fixed
plot(a_array,Pout(:,10).')
or you can plot Pout with respect to the variation of "PsByN_0dB" with "a" fixed
plot(PsByN_0dB_array,Pout(10,:))
(the 10 is of course arbitrary).
Or you can make a surface plot:
[A,PS] = ndgrid(a_array,PsByN_0dB_array)
surf(A,PS,Pout)
Dhawal Beohar
Dhawal Beohar 2022-8-17
Thanks for explaining different graphs. I really appreciate your help.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Historical Contests 的更多信息

标签

产品


版本

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by