"Symbolic parameters not supported in nonpolynomial equations"

2 Ansichten (letzte 30 Tage)
Maya Venugopalan
Maya Venugopalan am 7 Okt. 2020
clc;
clear all;
close all;
syms a b d y c
x = 0.1; %leading egde distance (in cm)
Re = 1000; %Reynolds number
delta = (5*x)/(Re^(1/2)); %Boundary layer thickness
nu = 8.926e-03; %kinematic viscosity (in cm2./s)
U_inf = (Re*nu)/x; %freestream velocity(in cm./s)
alpha = 1:1:20; %wave number (in 1./cm)
U(y) = a*y^2 + b*y + d; %velocity profile equation
DU(y) = diff(U(y),y);
eqn1 = U(0)==0; %boundary condition1
eqn2 = U(delta)==U_inf; %boundary condition2
eqn3 = DU(delta)==0; %boundary condition3
eqns = [eqn1 eqn2 eqn3];
soln = solve(eqns,a,b,d);
a = double(soln.a); %value of a in velocity profile (in 1./cm.s)
b = double(soln.b); %value of b in velocity profile (in 1./s)
d = double(soln.d); %value of d in velocity profile (in cm./s)
z = delta./2; %location of y
u = double(subs(a*z^2 + b*z + d));
ddu = double(2*a);
%Non-dimensionalizing
Uy = double(u./U_inf);
ddUy = double((ddu.*delta.^2)./U_inf);
A = double(alpha.*delta);
Y = z./delta;
%Roots of the OS equation
C = zeros(1,length(alpha));
for i=1:1:20
l1(i) = -((-((A(i).*Re.*c.*1i)-(2.*A(i).^2)-(A(i).*Re.*Uy.*1i))+((2.*A(i).^2.*Re.^2.*Uy.*c)-(A(i).^2.*Re.^2.*(Uy.^2+c.^2))-(4.*A(i).*Re.*ddUy.*1i)).^(1/2))/2).^(1./2);
l2(i) = -((-((A(i).*Re.*c.*1i)-(2.*A(i).^2)-(A(i).*Re.*Uy.*1i))-((2.*A(i).^2.*Re.^2.*Uy.*c)-(A(i).^2.*Re.^2.*(Uy.^2+c.^2))-(4.*A(i).*Re.*ddUy.*1i)).^(1/2))/2).^(1/2);
LHS = ((Uy-c).*((l1(i).^2.*exp(l1(i).*y) - l2(i).^2.*exp(l2(i).*y)) - (a(i).^2.*(exp(l1(i).*y)-exp(l2(i).*y))))-(ddUy.*(exp(l1(i).*y)-exp(l2(i).*y))));
RHS = ((1/(a(i).*Re.*1i)).*(((l1(i).^4.*exp(l1(i).*y))-(l2(i).^4.*exp(l2(i).*y)))-(2.*a(i).^2.*(l1(i).^2.*exp(l1(i).*y) - l2(i).^2.*exp(l2(i).*y))) + a(i).^4.*(exp(l1(i).*y)-exp(l2(i).*y))));
eqn(i) = LHS-RHS;
C(i) = vpasolve(simplify(eqn(i)),c);
end
disp(C)
There is error inside the for loop. Can somebody help?
Thanks!!

Antworten (1)

Walter Roberson
Walter Roberson am 7 Okt. 2020
C(i) = vpasolve(simplify(eqn(i)),c);
At that point in the code the equation involves more variables than just c, so you have more variables than equations.
vpasolve can handle more variables than equations only for polynomials, in which case it does the equivalent of solve() followed by vpa(), returning roots that involve the other variables.
  2 Kommentare
Maya Venugopalan
Maya Venugopalan am 8 Okt. 2020
So what should I do? I'm getting "Symbolic parameters not supported in nonpolynomial equations." again.
Maya Venugopalan
Maya Venugopalan am 8 Okt. 2020
When I tried to separate the for loop, I got the answer. But that too different values of c using different programs.
clc;
clear all;
close all;
syms c
delta = 0.0158;
alp = 1:1:20;
a = alp.*delta;
Re = 1000;
y = 0.5;
y1 = y.*delta;
U = (-357554.879.*y1.^2 + 11298.734.*y1)./89.26;
ddU = -2;
C = zeros(1,length(alp));
for i=1:1:20
l3(i) = -((-((a(i).*Re.*c.*1i)-(2.*a(i).^2)-(a(i).*Re.*U.*1i))+((2.*a(i).^2.*Re.^2.*U.*c)-(a(i).^2.*Re.^2.*(U.^2+c.^2))-(4.*a(i).*Re.*ddU.*1i)).^(1./2))./2).^(1./2);
l4(i) = -((-((a(i).*Re.*c.*1i)-(2.*a(i).^2)-(a(i).*Re.*U.*1i))-((2.*a(i).^2.*Re.^2.*U.*c)-(a(i).^2.*Re.^2.*(U.^2+c.^2))-(4.*a(i).*Re.*ddU.*1i)).^(1./2))./2).^(1./2);
LHS = ((U-c).*((l3(i).^2.*exp(l3(i).*y) - l4(i).^2.*exp(l4(i).*y)) - (a(i).^2.*(exp(l3(i).*y)-exp(l4(i).*y))))-(ddU.*(exp(l3(i).*y)-exp(l4(i).*y))));
RHS = ((1./(a(i).*Re.*1i)).*(((l3(i).^4.*exp(l3(i).*y))-(l4(i).^4.*exp(l4(i).*y)))-(2.*a(i).^2.*(l3(i).^2.*exp(l3(i).*y) - l4(i).^2.*exp(l4(i).*y))) + a(i).^4.*(exp(l3(i).*y)-exp(l4(i).*y))));
eqn(i) = LHS-RHS;
C(i) = vpasolve(simplify(eqn(i)),c);
end
disp(C)
This gives me solutions properly. But not as same values as the first code though. Why is that so?

Melden Sie sich an, um zu kommentieren.

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by