How to plot this equation and get this curve??

2 views (last 30 days)
STP
STP on 31 Aug 2020
Edited: Alan Stevens on 2 Sep 2020
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

Answers (1)

Alan Stevens
Alan Stevens on 31 Aug 2020
Edited: Alan Stevens on 1 Sep 2020
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 Comments
STP
STP on 2 Sep 2020
Edited: STP on 2 Sep 2020
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 on 2 Sep 2020
Edited: Alan Stevens on 2 Sep 2020
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.

Sign in to comment.

Categories

Find more on Numerical Integration and Differential Equations in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!