Clear Filters
Clear Filters

How to use vector value in equation?

1 view (last 30 days)
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

Accepted Answer

Torsten
Torsten on 10 Aug 2022
You mean
d0 = fun1(g0,a)
?
  19 Comments
Torsten
Torsten on 17 Aug 2022
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 on 17 Aug 2022
Thanks for explaining different graphs. I really appreciate your help.

Sign in to comment.

More Answers (0)

Categories

Find more on Historical Contests in Help Center and File Exchange

Tags

Products


Release

R2022a

Community Treasure Hunt

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

Start Hunting!