How to solve for a range of values

6 vues (au cours des 30 derniers jours)
Richard Baird
Richard Baird le 31 Mar 2021
I have a very simple expression with 2 variables , R1 and R2, that depend on each other. I want to plot the solution for R2 given a range of values for R1.
Here is what I have so far:
syms R2 positive
V = -9;
R1 = [100:100:1e6];
EQ = V.*(R1./(R1 + R2)) == -2.3;
plot(R1,solve(EQ,R2)) % produces an error, vectors must be of the same length

Réponse acceptée

Walter Roberson
Walter Roberson le 31 Mar 2021
syms r1 r2 positive
V = -9;
R1 = [100:100:1e6];
EQ = V.*(r1./(r1 + r2)) == -2.3;
R2sol = solve(EQ,r2);
R2 = double(subs(R2sol, r1, R1));
plot(R1, R2)

Plus de réponses (0)

Produits


Version

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by