Trying to solve a four variable equation for a range of values
1 view (last 30 days)
Show older comments
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 Comments
Ebrahim Soujeri
on 6 Apr 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.
Answers (1)
David Hill
on 6 Apr 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
0 Comments
See Also
Categories
Find more on Numbers and Precision 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!