error in for loop
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hi, I have this error:
Error using mupadengine/feval_internal
More equations than variables is only supported for polynomial systems.
sol = eng.feval_internal('symobj::vpasolve',eqns,vars,X0);
My code is the following one.
clear all
clc
syms x
Caudal=[5.93266E-05, 0.00082573, 0.001571951, 0.002318172, 0.003064541, 0.004018053, 0.00493061, 0.005552929, 0.006549172, 0.007338123, 0.008085823, 0.008833522, 0.009415033, 0.009996545, 0.010868442, 0.011574151, 0.012196174, 0.013025341, 0.013895908, 0.014848681, 0.015801455, 0.017251758, 0.018371164, 0.019200479, 0.019781399, 0.02036254, 0.020860957, 0.021234807, 0.021691677]; % m3/s
Presion=[1.638232756, 1.618669688, 1.579773777, 1.540877866, 1.496456555, 1.446449258, 1.379877876, 1.329967516, 1.230219498, 1.141582866, 1.047432951, 0.953283036, 0.881283191, 0.809283346, 0.71509708, 0.643060884, 0.604201324, 0.559755779, 0.515298116, 0.492917821, 0.470537526, 0.420384823, 0.359278257, 0.309307311, 0.259409068, 0.201222724, 0.140297914, 0.093222956, 0.037835664]; %m aire
densidad_aire=1.19; %su densidad a 25ºC en kg/m3
mu=0.0000174;
v_c=mu/densidad_aire; %viscosidad cinemática del aire
E_al=0.502; % rugosidad del disipador
L_disipador=0.045; % ancho disipador 45mm
Largo=0.095; %largo del disipador 95mm ("diametro")
Dist_alabe_alabe=0.002; % 2mm entre cada aleta
Diametro_mojado=(2*Largo*Dist_alabe_alabe)/(Largo+Dist_alabe_alabe);
A_disipador=Largo*Dist_alabe_alabe*45;
V=Caudal/A_disipador;
V_prom=mean(V, 'All')
for M=1:numel(Caudal)
V_Disipador=(Caudal/A_disipador);
Re=(V_Disipador*Diametro_mojado)/(v_c);
%f=vpasolve((1/sqrt(x)==-2*log((E_al/Largo)/3.7+2.51/(Re(M)*sqrt(x)))));
eqn=(1./sqrt(x))==-2.*log((E_al./Largo)./3.7+2.51./(Re.*sqrt(x)));
f=vpasolve(eqn);
h=f*(Largo/Diametro_mojado*V_prom).^2/(2*9.81);
end
0 comentarios
Respuestas (1)
Torsten
el 31 de Mayo de 2023
Editada: Torsten
el 31 de Mayo de 2023
I substituted 1/sqrt(x) by y in your equation. As you can see, there are only negative solutions such that resubstituting gives complex values for x.
clear all
clc
syms y
Caudal=[5.93266E-05, 0.00082573, 0.001571951, 0.002318172, 0.003064541, 0.004018053, 0.00493061, 0.005552929, 0.006549172, 0.007338123, 0.008085823, 0.008833522, 0.009415033, 0.009996545, 0.010868442, 0.011574151, 0.012196174, 0.013025341, 0.013895908, 0.014848681, 0.015801455, 0.017251758, 0.018371164, 0.019200479, 0.019781399, 0.02036254, 0.020860957, 0.021234807, 0.021691677]; % m3/s
Presion=[1.638232756, 1.618669688, 1.579773777, 1.540877866, 1.496456555, 1.446449258, 1.379877876, 1.329967516, 1.230219498, 1.141582866, 1.047432951, 0.953283036, 0.881283191, 0.809283346, 0.71509708, 0.643060884, 0.604201324, 0.559755779, 0.515298116, 0.492917821, 0.470537526, 0.420384823, 0.359278257, 0.309307311, 0.259409068, 0.201222724, 0.140297914, 0.093222956, 0.037835664]; %m aire
densidad_aire=1.19; %su densidad a 25ºC en kg/m3
mu=0.0000174;
v_c=mu/densidad_aire; %viscosidad cinemática del aire
E_al=0.502; % rugosidad del disipador
L_disipador=0.045; % ancho disipador 45mm
Largo=0.095; %largo del disipador 95mm ("diametro")
Dist_alabe_alabe=0.002; % 2mm entre cada aleta
Diametro_mojado=(2*Largo*Dist_alabe_alabe)/(Largo+Dist_alabe_alabe);
A_disipador=Largo*Dist_alabe_alabe*45;
V=Caudal/A_disipador;
V_prom=mean(V, 'All');
for M=1:numel(Caudal)
V_Disipador=(Caudal(M)/A_disipador);
Re=(V_Disipador*Diametro_mojado)/(v_c);
%f=vpasolve((1/sqrt(x)==-2*log((E_al/Largo)/3.7+2.51/(Re(M)*sqrt(x)))));
eqn=y==-2.*log(E_al./Largo./3.7+2.51.*y/Re);
f(M)=vpasolve(eqn);
if f(M) < 0
f(M)= 1i/f(M)^2;
else
f(M) = 1/f(M)^2;
end
h(M)=f(M)*(Largo/Diametro_mojado*V_prom).^2/(2*9.81);
end
0 comentarios
Ver también
Categorías
Más información sobre Special Values en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!