필터 지우기
필터 지우기

How to use vector value in equation?

조회 수: 1 (최근 30일)
Dhawal Beohar
Dhawal Beohar 2022년 8월 10일
댓글: Dhawal Beohar 2022년 8월 17일
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