How to solve for a range of values

8 views (last 30 days)
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

Accepted Answer

Walter Roberson
Walter Roberson on 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)

More Answers (0)

Products


Release

R2021a

Community Treasure Hunt

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

Start Hunting!