"Symbolic parameters not supported in nonpolynomial equations"
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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!!
0 Kommentare
Antworten (1)
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
Siehe auch
Kategorien
Mehr zu Calculus finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!