Issue solve function using complex numbers

Hi all,
I want to solve equation containing complex numbers.
The goal is to find R (Resistance value >0) that gives |Zeq| = 84 Omhs using solve function.
Following Matlab script should return 2 solutions:
solution #1 : close to 24 Ohms
solution #2 : close to 57 Ohms
but when I run the script , solve function returns no solution.
clc
clear
syms R Real;
C=5e-14;L=1.5e-10;Lc=3e-10;Cg=5e-14;Z1=50;Z2=50;
f=50e9;
w=2*pi*f;
Zp=2*1i*Lc*w + (R+1i*w*(L-R^2*C-L^2*C*w^2))/(1+C*((w^2*(R^2*C-2*L)+L^2*C*w^4)));
Yg=1i*Cg*w;
A=1+Yg*Zp;
B=Zp;
CC=Yg*(Yg*Zp+2);
D=A;
DEN=A*Z2+B+CC*Z1*Z2+D*Z1;
S11=(A*Z2+B-CC*Z1*Z2-D*Z1)/DEN;
Zv=84;
Zeq=abs((2*Z1*S11)/(1-S11));
solve(Zv==Zeq,R)
For information , I solved graphically this equation and solution #1 and #2 are found when the target value is |Zeq|=84.
Any suggestions ?

 Réponse acceptée

Star Strider
Star Strider le 23 Juin 2019
I cannot figure out the reason solve is not solving for those values.
I ended up with this:
Rfcn = matlabFunction(Zeq)
Rr(1) = fzero(@(R)Rfcn(R)-Zv, 1);
Rr(2) = fzero(@(R)Rfcn(R)-Zv, 100)
producing:
Rr =
23.823647889981203 57.458880414574708

2 commentaires

MGuillaume
MGuillaume le 30 Juin 2019
Thank you very much.
It works perfectly.
Star Strider
Star Strider le 30 Juin 2019
As always, my pleasure.

Connectez-vous pour commenter.

Plus de réponses (0)

Produits

Version

R2017a

Community Treasure Hunt

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

Start Hunting!

Translated by