empty sym 0-by-1

3 Ansichten (letzte 30 Tage)
Maya Venugopalan
Maya Venugopalan am 17 Okt. 2020
Beantwortet: Ameer Hamza am 17 Okt. 2020
clc;
clear all;
close all;
syms c
a = 13*0.0071;
Re = 5000;
ddU = -1.98;
U = 0.7425;
C = (a*Re*(U-c))/2;
N1 = (a^2/2) + sqrt((a^4/4) + ((C/2) + (0.5*sqrt(C^2 + (a*Re*ddU*1i))))^2);
N2 = (C/2) + sqrt((C/2)^2 + ((a*Re*ddU)/4));
D1 = (a^2/2) + sqrt((a^4/4) + ((C/2) - (0.5*sqrt(C^2 + (a*Re*ddU*1i))))^2);
D2 = (C/2) - sqrt((C/2)^2 + ((a*Re*ddU)/4));
LHS = (N1+(N2*1i))/(D1+(D2*1i));
RHS = sqrt(N1/D1);
eqn = LHS - RHS==0;
vpasolve(simplify(eqn),c)
I'm getting empty sym 0-by-1. How can I correct it?

Antworten (1)

Ameer Hamza
Ameer Hamza am 17 Okt. 2020
It means that the symbolic toolbox is unable to find a solution (even a numeric one). An altenative is to use optimization toolbox.
clc;
clear all;
close all;
syms c
a = 13*0.0071;
Re = 5000;
ddU = -1.98;
U = 0.7425;
C = (a*Re*(U-c))/2;
N1 = (a^2/2) + sqrt((a^4/4) + ((C/2) + (0.5*sqrt(C^2 + (a*Re*ddU*1i))))^2);
N2 = (C/2) + sqrt((C/2)^2 + ((a*Re*ddU)/4));
D1 = (a^2/2) + sqrt((a^4/4) + ((C/2) - (0.5*sqrt(C^2 + (a*Re*ddU*1i))))^2);
D2 = (C/2) - sqrt((C/2)^2 + ((a*Re*ddU)/4));
LHS = (N1+(N2*1i))/(D1+(D2*1i));
RHS = sqrt(N1/D1);
eqn = LHS - RHS==0;
eqn_fun = matlabFunction(LHS - RHS);
sol = fsolve(eqn_fun, 1)

Community Treasure Hunt

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

Start Hunting!

Translated by