Trying to solve a four variable equation for a range of values

1 visualización (últimos 30 días)
Freddie Hoare
Freddie Hoare el 6 de Abr. de 2021
Comentada: Freddie Hoare el 29 de Abr. de 2021
Hello, I am trying to solve a noise parameter equation:
eqn1 = F == Fmin + ((4*Rn)/Z0)*((abs(gammas-gammaopt))^2/(abs(1+gammaopt)^2*(1-abs(gammas)^2)));
I have values for Fmin, Rn, gammas and gammopt (with Z0 being a constant).
My question is, how do I input a range of values for these variables and output a range of values for F?
Sorry if this is a relatively easy question, but I am quite new with Matlab and have been spending most of my time trying to input a range of values from ADS.
  3 comentarios
Ebrahim Soujeri
Ebrahim Soujeri el 6 de Abr. de 2021
Hello
If you want to calculate F with respect to the variation one variable at a time (fixing other variables), you make a vector of that variable, and run your formula using the notation .* instead of * and .^2 instead of ^2
For example,
suppose that Rn has a range of -3 to +5 with intervals of 0.01
in Matlab you state:
Rn = -3 : 0.01 : 5;
Otherwise, you can construct a nested (for loop) that will produce a value for F, scanning the range of your input parameters.
Post an image of your formula here if you still need help.
Freddie Hoare
Freddie Hoare el 29 de Abr. de 2021
syms gammas Z0 Fmin Rn gammaopt gammasreal gammasimag gammaoptreal gammaoptimag
F=sym ('F', [1 11])
gammaoptreal = [-0.605, -0.646,-0.682 ,-0.713,-0.736,-0.756,-0.774 ,-0.789,-0.802,-0.814,-0.825];
gammaoptimag= [0.489,0.462,0.439,0.417,0.394,0.375,0.357,0.340,0.325,0.311,0.298];
gammasreal= [-0.819,-0.820,-0.820,-0.821,-0.822,-0.822,-0.822,-0.822,-0.823,-0.823,-0.823];
gammasimag=[-0.406,-0.407,-0.408,-0.409,-0.409,-0.410,-0.410,-0.411,-0.411,-0.411,-0.412];
Z0 = [50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100];
Fmin = [3.922, 3.901,3.973 ,4.057,4.018,3.991,3.973,3.960,3.951,3.945,3.941];
Rn = [21.801, 21.847, 22.880, 23.992, 23.609, 23.336,23.155 , 23.026, 22.937,22.876 ,22.842];
gammas=complex(gammasreal, gammasimag)
gammaopt = complex(gammaoptreal, gammaoptimag)
solveF=F == Fmin + ((4*Rn)/Z0)*((abs(gammas-gammaopt).*abs(gammas-gammaopt)) /(abs(1+gammaopt).*abs(1+gammaopt) .*(1-abs(gammas).*abs(gammas) )));
% gammas = s_11 F = noise factor gammaopt = sopt Rn == noise
% resistance
Hi there, sorry I have taken so long to respond. Hope you are still available to help with this!
The values are all 1*11 arrays.

Iniciar sesión para comentar.

Respuestas (1)

David Hill
David Hill el 6 de Abr. de 2021
If you want all possible combinations, then use ndgrid.
Z0=1.5;
Fmin=0:10;
Rn=1:20;
gammas=-10:1;
gammopt=13:.1:20;%I have no idea what these values are, just examples
[Fmin,Rn,gammas,gammopt]=ndgrid(Fmin,Rn,gammas,gammopt);%creates all possible combinations
F = Fmin(:) + (4*Rn(:)/Z0.*(gammas(:)-gammaopt(:)).^2)./((1+gammaopt(:)).^2.*(1-gammas(:).^2));
F=reshape(F,size(Fmin));%shapes F to same size as other matrices

Categorías

Más información sobre Numbers and Precision en Help Center y File Exchange.

Productos


Versión

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by