# How to use vector value in equation?

3 views (last 30 days)
Dhawal Beohar on 10 Aug 2022
Commented: Dhawal Beohar on 17 Aug 2022
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 on 10 Aug 2022
You mean
d0 = fun1(g0,a)
?
Dhawal Beohar on 17 Aug 2022
Thanks for explaining different graphs. I really appreciate your help.

R2022a

### Community Treasure Hunt

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

Start Hunting!