How to plot this equation and get this curve??

3 visualizzazioni (ultimi 30 giorni)
STP
STP il 31 Ago 2020
Modificato: Alan Stevens il 2 Set 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

Risposte (1)

Alan Stevens
Alan Stevens il 31 Ago 2020
Modificato: Alan Stevens il 1 Set 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 Commenti
STP
STP il 2 Set 2020
Modificato: STP il 2 Set 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 il 2 Set 2020
Modificato: Alan Stevens il 2 Set 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.

Accedi per commentare.

Categorie

Scopri di più su Numerical Integration and Differential Equations in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by