How to plot this equation and get this curve??

조회 수: 3 (최근 30일)
STP
STP 2020년 8월 31일
편집: Alan Stevens 2020년 9월 2일
Here is the equation :
T = 10.^(-A/20)
The plot of A vs C is :
My code so far:
N = 15;
C = linspace(0, 35, N);
A = linspace(0, 10, N);
T = 10.^(-A./20);
X = sqrt(1-C.^2);
Y = 1-T.*X;
PG = (C/Y).^2;
for a1 = 1:numel(C)
for a2 = 1:numel(A)
X = sqrt(1-C.^2);
Y = 1-T.*X;
PG = (C/Y).^2;
plot(C,A);
xlabel('C (dB)');
ylabel('A (dB)');
title(sprintf('Power multiplication'))
end
end

답변 (1개)

Alan Stevens
Alan Stevens 2020년 8월 31일
편집: Alan Stevens 2020년 9월 1일
The following plots the curves:
Cfn = @(CdB) 10.^(-CdB/20);
Tfn = @(C,M) (1 - C./M.^0.5)./(1 - C.^2).^0.5;
Afn = @(T) -20*log10(T);
Mvals = [2, 5:5:20, 30, 40, 50];
CdB = 1:0.05:24;
C = Cfn(CdB);
str = [];
for j = 1:numel(Mvals)
M = Mvals(j);
for k = 1:numel(CdB)
T = Tfn(C(k),M);
A(k) = Afn(T);
end
A(A<0)=NaN;
semilogy(CdB,A)
hold on
str = [str;sprintf('%4d',M)];
end
axis([0 28 0.01 10] )
grid
xlabel('C [dB]'), ylabel('A [dB]')
legend(str)
  댓글 수: 2
STP
STP 2020년 9월 2일
편집: STP 2020년 9월 2일
Hi, thankyou. Semilogy is new for me. :)
How to go about to get different values on X-Y axis for eg. M on Y and A on X (for different C), etc etc along with the current one?
Alan Stevens
Alan Stevens 2020년 9월 2일
편집: Alan Stevens 2020년 9월 2일
As follows:
Mfn = @(C,T) (C./(1-T.*(1 - C.^2).^0.5)).^2;
CdB = 4:4:16;
C = Cfn(CdB);
T = 10^-5:10^-3:1;
AdB = Afn(T);
str = [];
for j = 1:numel(CdB)
for k = 1:numel(T)
M(k) = Mfn(C(j),T(k));
end
semilogx(AdB,M)
hold on
str = [str; sprintf('C = %4d', CdB(j)) ];
end
grid
xlabel('A [dB]'), ylabel('M')
legend(str)
Or with CdB = 10 and 12:
Note that this matches your last image only if the C values are positive, rather than the negative values on the image.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Numerical Integration and Differential Equations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by