Solve equation and standalone program
显示 更早的评论
Hi ! I created a matlab code that uses the solve function provided by the Symbolic Math Toolbox. The code works fine. Then I want to create a standalone program using the matlab compiler. Apparently the Symbolic Math Toolbox can't be included during the compilation. Do you have an idea, advice... ?
Thanks.
Regards
采纳的回答
If the equations are pre-determined and only coefficients need to be determined, then you can use matlabFunction() to generate the MATLAB Code into a file. Then set up your program to not generate the equations and instead call upon the pre-saved MATLAB to determine the results. This second program can then be compiled.
12 个评论
Hello Sir, I'm having the same problem. Can you give me an example on how to use the matlabFunction and how to call it in my code? Thank you.
if ~isdeployed()
syms x y
expr = solve(x^3 - 2*x + y, x);
fun = matlabfunction(expr, 'vars', y, 'file', 'abbracordovidae.m');
else
fun = @abbracordovidae;
end
Hi Walter, I've been trying to use the matlab function as well as ~isdeployed() as shown from your example above but have not been having luck. Could you assist me with me code as shown below please.
In summary, I'm trying to run the below code within a standalone program
% solve for x
syms x
x1 = solve(slope*x + yint == perpslope*x + perpyint,x);
This is what I have tried with the ~isdeployed and matlabFunction:
if ~isdeployed()
syms x
exp = solve(slope*x + yint == perpslope*x + perpyint,x)
x1 = matlabFunction(exp, x);
end
Thank you so much
if ~isdeployed()
syms x
sol = solve(slope*x + yint == perpslope*x + perapyint, x)
x1fun = matlabFunction(sol, 'vars', {x}, 'File', 'x1_externalized.m', 'optimize', false);
else
%recall the previously saved function. Hope it is up to date with the latest parameters.
x1fun = @x1_externalized;
end
x1 = x1fun(actual_x_value);
However, it is more likely that you would want to generate it with more parameters. Anything that is not constant at that point should be made a symbolic variable and added to the 'vars' list at the time the function is generated.
It is true, though, that in some cases making a value from a numeric parameter into a symbolic parameter can result in solve() not being able to find a solution. For example, if your expression included x^perpexp and perpexp was numerically -4, -3, -2, -1, 0, 1, 2, 3, or 4, then solve() would be able to solve into explicit numeric formulas, but that if you made perpexp symbolic then solve() would not be able to come up with an answer.
João Barbosa
2022-12-21
编辑:João Barbosa
2022-12-21
I have the same problem can you please help me?
syms t80
for i=1:t
eq_FASE= thetai_FASE+(t80/(xd_FASE*E_FASE))-((w_FASE^2*Leq_FASE(i)^2)/(24*xd_FASE*S_FASE^2*t80^2)) == thetak_FASE(i) +(tmax_FASE/(xd_FASE*E_FASE))-((m_FASE(i)^2*w_FASE^2*Leq_FASE(i)^2)/(24*xd_FASE*S_FASE^2*tmax_FASE^2));
eq_CG= thetai_CG+(t80/(xd_CG*E_CG))-((w_CG^2*Leq_CG(i)^2)/(24*xd_CG*S_CG^2*t80^2)) == thetak_CG(i) +(tmax_CG/(xd_CG*E_CG))-((m_CG(i)^2*w_CG^2*Leq_CG(i)^2)/(24*xd_CG*S_CG^2*tmax_CG^2));
xpto_FASE=double(solve(eq_FASE,t80));
xpto_CG=double(solve(eq_CG,t80));
idx_FASE=xpto_FASE>0;
idx_CG=xpto_CG>0;
ti_FASE(i)=xpto_FASE(idx_FASE);
ti_CG(i)=xpto_CG(idx_CG);
T_FASE(i)=double(ti_FASE(i)*S_FASE);
T_CG(i)=double(ti_CG(i)*S_CG);
p_FASE(i)=double(T_FASE(i)/w_FASE);
p_CG(i)=double(T_CG(i)/w_CG);
end
syms t80
syms thetai_FASE xd_FASE E_FASE w_FASE Leq_FASE S_FASE thetak_FASE tmax_FASE m_FASE
syms thetai_CG xd_CG E_CG w_CG Leq_CG S_CG thetak_CG tmax_CG m_CG
eq_FASE= thetai_FASE+(t80/(xd_FASE*E_FASE))-((w_FASE^2*Leq_FASE^2)/(24*xd_FASE*S_FASE^2*t80^2)) == thetak_FASE +(tmax_FASE/(xd_FASE*E_FASE))-((m_FASE^2*w_FASE^2*Leq_FASE^2)/(24*xd_FASE*S_FASE^2*tmax_FASE^2));
eq_CG= thetai_CG+(t80/(xd_CG*E_CG))-((w_CG^2*Leq_CG^2)/(24*xd_CG*S_CG^2*t80^2)) == thetak_CG +(tmax_CG/(xd_CG*E_CG))-((m_CG^2*w_CG^2*Leq_CG^2)/(24*xd_CG*S_CG^2*tmax_CG^2));
t80_FASE = solve(eq_FASE,t80,'MaxDegree',3);
t80_FASE = matlabFunction(t80_FASE)
t80_FASE = function_handle with value:
@(E_FASE,Leq_FASE,S_FASE,m_FASE,thetai_FASE,thetak_FASE,tmax_FASE,w_FASE,xd_FASE)[(sqrt(((1.0./S_FASE.^6.*1.0./tmax_FASE.^6.*(S_FASE.^2.*tmax_FASE.^3.*2.4e+1-E_FASE.*Leq_FASE.^2.*m_FASE.^2.*w_FASE.^2-E_FASE.*S_FASE.^2.*thetai_FASE.*tmax_FASE.^2.*xd_FASE.*2.4e+1+E_FASE.*S_FASE.^2.*thetak_FASE.*tmax_FASE.^2.*xd_FASE.*2.4e+1).^3)./3.73248e+5+(E_FASE.*Leq_FASE.^2.*1.0./S_FASE.^2.*w_FASE.^2)./4.8e+1).^2-(1.0./S_FASE.^12.*1.0./tmax_FASE.^12.*(S_FASE.^2.*tmax_FASE.^3.*2.4e+1-E_FASE.*Leq_FASE.^2.*m_FASE.^2.*w_FASE.^2-E_FASE.*S_FASE.^2.*thetai_FASE.*tmax_FASE.^2.*xd_FASE.*2.4e+1+E_FASE.*S_FASE.^2.*thetak_FASE.*tmax_FASE.^2.*xd_FASE.*2.4e+1).^6)./1.39314069504e+11)+(1.0./S_FASE.^6.*1.0./tmax_FASE.^6.*(S_FASE.^2.*tmax_FASE.^3.*2.4e+1-E_FASE.*Leq_FASE.^2.*m_FASE.^2.*w_FASE.^2-E_FASE.*S_FASE.^2.*thetai_FASE.*tmax_FASE.^2.*xd_FASE.*2.4e+1+E_FASE.*S_FASE.^2.*thetak_FASE.*tmax_FASE.^2.*xd_FASE.*2.4e+1).^3)./3.73248e+5+(E_FASE.*Leq_FASE.^2.*1.0./S_FASE.^2.*w_FASE.^2)./4.8e+1).^(1.0./3.0)+(1.0./S_FASE.^2.*1.0./tmax_FASE.^2.*(S_FASE.^2.*tmax_FASE.^3.*2.4e+1-E_FASE.*Leq_FASE.^2.*m_FASE.^2.*w_FASE.^2-E_FASE.*S_FASE.^2.*thetai_FASE.*tmax_FASE.^2.*xd_FASE.*2.4e+1+E_FASE.*S_FASE.^2.*thetak_FASE.*tmax_FASE.^2.*xd_FASE.*2.4e+1))./7.2e+1+(1.0./S_FASE.^4.*1.0./tmax_FASE.^4.*1.0./(sqrt(((1.0./S_FASE.^6.*1.0./tmax_FASE.^6.*(S_FASE.^2.*tmax_FASE.^3.*2.4e+1-E_FASE.*Leq_FASE.^2.*m_FASE.^2.*w_FASE.^2-E_FASE.*S_FASE.^2.*thetai_FASE.*tmax_FASE.^2.*xd_FASE.*2.4e+1+E_FASE.*S_FASE.^2.*thetak_FASE.*tmax_FASE.^2.*xd_FASE.*2.4e+1).^3)./3.73248e+5+(E_FASE.*Leq_FASE.^2.*1.0./S_FASE.^2.*w_FASE.^2)./4.8e+1).^2-(1.0./S_FASE.^12.*1.0./tmax_FASE.^12.*(S_FASE.^2.*tmax_FASE.^3.*2.4e+1-E_FASE.*Leq_FASE.^2.*m_FASE.^2.*w_FASE.^2-E_FASE.*S_FASE.^2.*thetai_FASE.*tmax_FASE.^2.*xd_FASE.*2.4e+1+E_FASE.*S_FASE.^2.*thetak_FASE.*tmax_FASE.^2.*xd_FASE.*2.4e+1).^6)./1.39314069504e+11)+(1.0./S_FASE.^6.*1.0./tmax_FASE.^6.*(S_FASE.^2.*tmax_FASE.^3.*2.4e+1-E_FASE.*Leq_FASE.^2.*m_FASE.^2.*w_FASE.^2-E_FASE.*S_FASE.^2.*thetai_FASE.*tmax_FASE.^2.*xd_FASE.*2.4e+1+E_FASE.*S_FASE.^2.*thetak_FASE.*tmax_FASE.^2.*xd_FASE.*2.4e+1).^3)./3.73248e+5+(E_FASE.*Leq_FASE.^2.*1.0./S_FASE.^2.*w_FASE.^2)./4.8e+1).^(1.0./3.0).*(S_FASE.^2.*tmax_FASE.^3.*2.4e+1-E_FASE.*Leq_FASE.^2.*m_FASE.^2.*w_FASE.^2-E_FASE.*S_FASE.^2.*thetai_FASE.*tmax_FASE.^2.*xd_FASE.*2.4e+1+E_FASE.*S_FASE.^2.*thetak_FASE.*tmax_FASE.^2.*xd_FASE.*2.4e+1).^2)./5.184e+3;(sqrt(((1.0./S_FASE.^6.*1.0./tmax_FASE.^6.*(S_FASE.^2.*tmax_FASE.^3.*2.4e+1-E_FASE.*Leq_FASE.^2.*m_FASE.^2.*w_FASE.^2-E_FASE.*S_FASE.^2.*thetai_FASE.*tmax_FASE.^2.*xd_FASE.*2.4e+1+E_FASE.*S_FASE.^2.*thetak_FASE.*tmax_FASE.^2.*xd_FASE.*2.4e+1).^3)./3.73248e+5+(E_FASE.*Leq_FASE.^2.*1.0./S_FASE.^2.*w_FASE.^2)./4.8e+1).^2-(1.0./S_FASE.^12.*1.0./tmax_FASE.^12.*(S_FASE.^2.*tmax_FASE.^3.*2.4e+1-E_FASE.*Leq_FASE.^2.*m_FASE.^2.*w_FASE.^2-E_FASE.*S_FASE.^2.*thetai_FASE.*tmax_FASE.^2.*xd_FASE.*2.4e+1+E_FASE.*S_FASE.^2.*thetak_FASE.*tmax_FASE.^2.*xd_FASE.*2.4e+1).^6)./1.39314069504e+11)+(1.0./S_FASE.^6.*1.0./tmax_FASE.^6.*(S_FASE.^2.*tmax_FASE.^3.*2.4e+1-E_FASE.*Leq_FASE.^2.*m_FASE.^2.*w_FASE.^2-E_FASE.*S_FASE.^2.*thetai_FASE.*tmax_FASE.^2.*xd_FASE.*2.4e+1+E_FASE.*S_FASE.^2.*thetak_FASE.*tmax_FASE.^2.*xd_FASE.*2.4e+1).^3)./3.73248e+5+(E_FASE.*Leq_FASE.^2.*1.0./S_FASE.^2.*w_FASE.^2)./4.8e+1).^(1.0./3.0).*(-1.0./2.0)-sqrt(3.0).*((sqrt(((1.0./S_FASE.^6.*1.0./tmax_FASE.^6.*(S_FASE.^2.*tmax_FASE.^3.*2.4e+1-E_FASE.*Leq_FASE.^2.*m_FASE.^2.*w_FASE.^2-E_FASE.*S_FASE.^2.*thetai_FASE.*tmax_FASE.^2.*xd_FASE.*2.4e+1+E_FASE.*S_FASE.^2.*thetak_FASE.*tmax_FASE.^2.*xd_FASE.*2.4e+1).^3)./3.73248e+5+(E_FASE.*Leq_FASE.^2.*1.0./S_FASE.^2.*w_FASE.^2)./4.8e+1).^2-(1.0./S_FASE.^12.*1.0./tmax_FASE.^12.*(S_FASE.^2.*tmax_FASE.^3.*2.4e+1-E_FASE.*Leq_FASE.^2.*m_FASE.^2.*w_FASE.^2-E_FASE.*S_FASE.^2.*thetai_FASE.*tmax_FASE.^2.*xd_FASE.*2.4e+1+E_FASE.*S_FASE.^2.*thetak_FASE.*tmax_FASE.^2.*xd_FASE.*2.4e+1).^6)./1.39314069504e+11)+(1.0./S_FASE.^6.*1.0./tmax_FASE.^6.*(S_FASE.^2.*tmax_FASE.^3.*2.4e+1-E_FASE.*Leq_FASE.^2.*m_FASE.^2.*w_FASE.^2-E_FASE.*S_FASE.^2.*thetai_FASE.*tmax_FASE.^2.*xd_FASE.*2.4e+1+E_FASE.*S_FASE.^2.*thetak_FASE.*tmax_FASE.^2.*xd_FASE.*2.4e+1).^3)./3.73248e+5+(E_FASE.*Leq_FASE.^2.*1.0./S_FASE.^2.*w_FASE.^2)./4.8e+1).^(1.0./3.0)-(1.0./S_FASE.^4.*1.0./tmax_FASE.^4.*1.0./(sqrt(((1.0./S_FASE.^6.*1.0./tmax_FASE.^6.*(S_FASE.^2.*tmax_FASE.^3.*2.4e+1-E_FASE.*Leq_FASE.^2.*m_FASE.^2.*w_FASE.^2-E_FASE.*S_FASE.^2.*thetai_FASE.*tmax_FASE.^2.*xd_FASE.*2.4e+1+E_FASE.*S_FASE.^2.*thetak_FASE.*tmax_FASE.^2.*xd_FASE.*2.4e+1).^3)./3.73248e+5+(E_FASE.*Leq_FASE.^2.*1.0./S_FASE.^2.*w_FASE.^2)./4.8e+1).^2-(1.0./S_FASE.^12.*1.0./tmax_FASE.^12.*(S_FASE.^2.*tmax_FASE.^3.*2.4e+1-E_FASE.*Leq_FASE.^2.*m_FASE.^2.*w_FASE.^2-E_FASE.*S_FASE.^2.*thetai_FASE.*tmax_FASE.^2.*xd_FASE.*2.4e+1+E_FASE.*S_FASE.^2.*thetak_FASE.*tmax_FASE.^2.*xd_FASE.*2.4e+1).^6)./1.39314069504e+11)+(1.0./S_FASE.^6.*1.0./tmax_FASE.^6.*(S_FASE.^2.*tmax_FASE.^3.*2.4e+1-E_FASE.*Leq_FASE.^2.*m_FASE.^2.*w_FASE.^2-E_FASE.*S_FASE.^2.*thetai_FASE.*tmax_FASE.^2.*xd_FASE.*2.4e+1+E_FASE.*S_FASE.^2.*thetak_FASE.*tmax_FASE.^2.*xd_FASE.*2.4e+1).^3)./3.73248e+5+(E_FASE.*Leq_FASE.^2.*1.0./S_FASE.^2.*w_FASE.^2)./4.8e+1).^(1.0./3.0).*(S_FASE.^2.*tmax_FASE.^3.*2.4e+1-E_FASE.*Leq_FASE.^2.*m_FASE.^2.*w_FASE.^2-E_FASE.*S_FASE.^2.*thetai_FASE.*tmax_FASE.^2.*xd_FASE.*2.4e+1+E_FASE.*S_FASE.^2.*thetak_FASE.*tmax_FASE.^2.*xd_FASE.*2.4e+1).^2)./5.184e+3).*5.0e-1i+(1.0./S_FASE.^2.*1.0./tmax_FASE.^2.*(S_FASE.^2.*tmax_FASE.^3.*2.4e+1-E_FASE.*Leq_FASE.^2.*m_FASE.^2.*w_FASE.^2-E_FASE.*S_FASE.^2.*thetai_FASE.*tmax_FASE.^2.*xd_FASE.*2.4e+1+E_FASE.*S_FASE.^2.*thetak_FASE.*tmax_FASE.^2.*xd_FASE.*2.4e+1))./7.2e+1-(1.0./S_FASE.^4.*1.0./tmax_FASE.^4.*1.0./(sqrt(((1.0./S_FASE.^6.*1.0./tmax_FASE.^6.*(S_FASE.^2.*tmax_FASE.^3.*2.4e+1-E_FASE.*Leq_FASE.^2.*m_FASE.^2.*w_FASE.^2-E_FASE.*S_FASE.^2.*thetai_FASE.*tmax_FASE.^2.*xd_FASE.*2.4e+1+E_FASE.*S_FASE.^2.*thetak_FASE.*tmax_FASE.^2.*xd_FASE.*2.4e+1).^3)./3.73248e+5+(E_FASE.*Leq_FASE.^2.*1.0./S_FASE.^2.*w_FASE.^2)./4.8e+1).^2-(1.0./S_FASE.^12.*1.0./tmax_FASE.^12.*(S_FASE.^2.*tmax_FASE.^3.*2.4e+1-E_FASE.*Leq_FASE.^2.*m_FASE.^2.*w_FASE.^2-E_FASE.*S_FASE.^2.*thetai_FASE.*tmax_FASE.^2.*xd_FASE.*2.4e+1+E_FASE.*S_FASE.^2.*thetak_FASE.*tmax_FASE.^2.*xd_FASE.*2.4e+1).^6)./1.39314069504e+11)+(1.0./S_FASE.^6.*1.0./tmax_FASE.^6.*(S_FASE.^2.*tmax_FASE.^3.*2.4e+1-E_FASE.*Leq_FASE.^2.*m_FASE.^2.*w_FASE.^2-E_FASE.*S_FASE.^2.*thetai_FASE.*tmax_FASE.^2.*xd_FASE.*2.4e+1+E_FASE.*S_FASE.^2.*thetak_FASE.*tmax_FASE.^2.*xd_FASE.*2.4e+1).^3)./3.73248e+5+(E_FASE.*Leq_FASE.^2.*1.0./S_FASE.^2.*w_FASE.^2)./4.8e+1).^(1.0./3.0).*(S_FASE.^2.*tmax_FASE.^3.*2.4e+1-E_FASE.*Leq_FASE.^2.*m_FASE.^2.*w_FASE.^2-E_FASE.*S_FASE.^2.*thetai_FASE.*tmax_FASE.^2.*xd_FASE.*2.4e+1+E_FASE.*S_FASE.^2.*thetak_FASE.*tmax_FASE.^2.*xd_FASE.*2.4e+1).^2)./1.0368e+4;(sqrt(((1.0./S_FASE.^6.*1.0./tmax_FASE.^6.*(S_FASE.^2.*tmax_FASE.^3.*2.4e+1-E_FASE.*Leq_FASE.^2.*m_FASE.^2.*w_FASE.^2-E_FASE.*S_FASE.^2.*thetai_FASE.*tmax_FASE.^2.*xd_FASE.*2.4e+1+E_FASE.*S_FASE.^2.*thetak_FASE.*tmax_FASE.^2.*xd_FASE.*2.4e+1).^3)./3.73248e+5+(E_FASE.*Leq_FASE.^2.*1.0./S_FASE.^2.*w_FASE.^2)./4.8e+1).^2-(1.0./S_FASE.^12.*1.0./tmax_FASE.^12.*(S_FASE.^2.*tmax_FASE.^3.*2.4e+1-E_FASE.*Leq_FASE.^2.*m_FASE.^2.*w_FASE.^2-E_FASE.*S_FASE.^2.*thetai_FASE.*tmax_FASE.^2.*xd_FASE.*2.4e+1+E_FASE.*S_FASE.^2.*thetak_FASE.*tmax_FASE.^2.*xd_FASE.*2.4e+1).^6)./1.39314069504e+11)+(1.0./S_FASE.^6.*1.0./tmax_FASE.^6.*(S_FASE.^2.*tmax_FASE.^3.*2.4e+1-E_FASE.*Leq_FASE.^2.*m_FASE.^2.*w_FASE.^2-E_FASE.*S_FASE.^2.*thetai_FASE.*tmax_FASE.^2.*xd_FASE.*2.4e+1+E_FASE.*S_FASE.^2.*thetak_FASE.*tmax_FASE.^2.*xd_FASE.*2.4e+1).^3)./3.73248e+5+(E_FASE.*Leq_FASE.^2.*1.0./S_FASE.^2.*w_FASE.^2)./4.8e+1).^(1.0./3.0).*(-1.0./2.0)+sqrt(3.0).*((sqrt(((1.0./S_FASE.^6.*1.0./tmax_FASE.^6.*(S_FASE.^2.*tmax_FASE.^3.*2.4e+1-E_FASE.*Leq_FASE.^2.*m_FASE.^2.*w_FASE.^2-E_FASE.*S_FASE.^2.*thetai_FASE.*tmax_FASE.^2.*xd_FASE.*2.4e+1+E_FASE.*S_FASE.^2.*thetak_FASE.*tmax_FASE.^2.*xd_FASE.*2.4e+1).^3)./3.73248e+5+(E_FASE.*Leq_FASE.^2.*1.0./S_FASE.^2.*w_FASE.^2)./4.8e+1).^2-(1.0./S_FASE.^12.*1.0./tmax_FASE.^12.*(S_FASE.^2.*tmax_FASE.^3.*2.4e+1-E_FASE.*Leq_FASE.^2.*m_FASE.^2.*w_FASE.^2-E_FASE.*S_FASE.^2.*thetai_FASE.*tmax_FASE.^2.*xd_FASE.*2.4e+1+E_FASE.*S_FASE.^2.*thetak_FASE.*tmax_FASE.^2.*xd_FASE.*2.4e+1).^6)./1.39314069504e+11)+(1.0./S_FASE.^6.*1.0./tmax_FASE.^6.*(S_FASE.^2.*tmax_FASE.^3.*2.4e+1-E_FASE.*Leq_FASE.^2.*m_FASE.^2.*w_FASE.^2-E_FASE.*S_FASE.^2.*thetai_FASE.*tmax_FASE.^2.*xd_FASE.*2.4e+1+E_FASE.*S_FASE.^2.*thetak_FASE.*tmax_FASE.^2.*xd_FASE.*2.4e+1).^3)./3.73248e+5+(E_FASE.*Leq_FASE.^2.*1.0./S_FASE.^2.*w_FASE.^2)./4.8e+1).^(1.0./3.0)-(1.0./S_FASE.^4.*1.0./tmax_FASE.^4.*1.0./(sqrt(((1.0./S_FASE.^6.*1.0./tmax_FASE.^6.*(S_FASE.^2.*tmax_FASE.^3.*2.4e+1-E_FASE.*Leq_FASE.^2.*m_FASE.^2.*w_FASE.^2-E_FASE.*S_FASE.^2.*thetai_FASE.*tmax_FASE.^2.*xd_FASE.*2.4e+1+E_FASE.*S_FASE.^2.*thetak_FASE.*tmax_FASE.^2.*xd_FASE.*2.4e+1).^3)./3.73248e+5+(E_FASE.*Leq_FASE.^2.*1.0./S_FASE.^2.*w_FASE.^2)./4.8e+1).^2-(1.0./S_FASE.^12.*1.0./tmax_FASE.^12.*(S_FASE.^2.*tmax_FASE.^3.*2.4e+1-E_FASE.*Leq_FASE.^2.*m_FASE.^2.*w_FASE.^2-E_FASE.*S_FASE.^2.*thetai_FASE.*tmax_FASE.^2.*xd_FASE.*2.4e+1+E_FASE.*S_FASE.^2.*thetak_FASE.*tmax_FASE.^2.*xd_FASE.*2.4e+1).^6)./1.39314069504e+11)+(1.0./S_FASE.^6.*1.0./tmax_FASE.^6.*(S_FASE.^2.*tmax_FASE.^3.*2.4e+1-E_FASE.*Leq_FASE.^2.*m_FASE.^2.*w_FASE.^2-E_FASE.*S_FASE.^2.*thetai_FASE.*tmax_FASE.^2.*xd_FASE.*2.4e+1+E_FASE.*S_FASE.^2.*thetak_FASE.*tmax_FASE.^2.*xd_FASE.*2.4e+1).^3)./3.73248e+5+(E_FASE.*Leq_FASE.^2.*1.0./S_FASE.^2.*w_FASE.^2)./4.8e+1).^(1.0./3.0).*(S_FASE.^2.*tmax_FASE.^3.*2.4e+1-E_FASE.*Leq_FASE.^2.*m_FASE.^2.*w_FASE.^2-E_FASE.*S_FASE.^2.*thetai_FASE.*tmax_FASE.^2.*xd_FASE.*2.4e+1+E_FASE.*S_FASE.^2.*thetak_FASE.*tmax_FASE.^2.*xd_FASE.*2.4e+1).^2)./5.184e+3).*5.0e-1i+(1.0./S_FASE.^2.*1.0./tmax_FASE.^2.*(S_FASE.^2.*tmax_FASE.^3.*2.4e+1-E_FASE.*Leq_FASE.^2.*m_FASE.^2.*w_FASE.^2-E_FASE.*S_FASE.^2.*thetai_FASE.*tmax_FASE.^2.*xd_FASE.*2.4e+1+E_FASE.*S_FASE.^2.*thetak_FASE.*tmax_FASE.^2.*xd_FASE.*2.4e+1))./7.2e+1-(1.0./S_FASE.^4.*1.0./tmax_FASE.^4.*1.0./(sqrt(((1.0./S_FASE.^6.*1.0./tmax_FASE.^6.*(S_FASE.^2.*tmax_FASE.^3.*2.4e+1-E_FASE.*Leq_FASE.^2.*m_FASE.^2.*w_FASE.^2-E_FASE.*S_FASE.^2.*thetai_FASE.*tmax_FASE.^2.*xd_FASE.*2.4e+1+E_FASE.*S_FASE.^2.*thetak_FASE.*tmax_FASE.^2.*xd_FASE.*2.4e+1).^3)./3.73248e+5+(E_FASE.*Leq_FASE.^2.*1.0./S_FASE.^2.*w_FASE.^2)./4.8e+1).^2-(1.0./S_FASE.^12.*1.0./tmax_FASE.^12.*(S_FASE.^2.*tmax_FASE.^3.*2.4e+1-E_FASE.*Leq_FASE.^2.*m_FASE.^2.*w_FASE.^2-E_FASE.*S_FASE.^2.*thetai_FASE.*tmax_FASE.^2.*xd_FASE.*2.4e+1+E_FASE.*S_FASE.^2.*thetak_FASE.*tmax_FASE.^2.*xd_FASE.*2.4e+1).^6)./1.39314069504e+11)+(1.0./S_FASE.^6.*1.0./tmax_FASE.^6.*(S_FASE.^2.*tmax_FASE.^3.*2.4e+1-E_FASE.*Leq_FASE.^2.*m_FASE.^2.*w_FASE.^2-E_FASE.*S_FASE.^2.*thetai_FASE.*tmax_FASE.^2.*xd_FASE.*2.4e+1+E_FASE.*S_FASE.^2.*thetak_FASE.*tmax_FASE.^2.*xd_FASE.*2.4e+1).^3)./3.73248e+5+(E_FASE.*Leq_FASE.^2.*1.0./S_FASE.^2.*w_FASE.^2)./4.8e+1).^(1.0./3.0).*(S_FASE.^2.*tmax_FASE.^3.*2.4e+1-E_FASE.*Leq_FASE.^2.*m_FASE.^2.*w_FASE.^2-E_FASE.*S_FASE.^2.*thetai_FASE.*tmax_FASE.^2.*xd_FASE.*2.4e+1+E_FASE.*S_FASE.^2.*thetak_FASE.*tmax_FASE.^2.*xd_FASE.*2.4e+1).^2)./1.0368e+4]
t80_CG = solve(eq_CG,t80,'MaxDegree',3);
t80_CG = matlabFunction(t80_CG)
t80_CG = function_handle with value:
@(E_CG,Leq_CG,S_CG,m_CG,thetai_CG,thetak_CG,tmax_CG,w_CG,xd_CG)[(sqrt(((1.0./S_CG.^6.*1.0./tmax_CG.^6.*(S_CG.^2.*tmax_CG.^3.*2.4e+1-E_CG.*Leq_CG.^2.*m_CG.^2.*w_CG.^2-E_CG.*S_CG.^2.*thetai_CG.*tmax_CG.^2.*xd_CG.*2.4e+1+E_CG.*S_CG.^2.*thetak_CG.*tmax_CG.^2.*xd_CG.*2.4e+1).^3)./3.73248e+5+(E_CG.*Leq_CG.^2.*1.0./S_CG.^2.*w_CG.^2)./4.8e+1).^2-(1.0./S_CG.^12.*1.0./tmax_CG.^12.*(S_CG.^2.*tmax_CG.^3.*2.4e+1-E_CG.*Leq_CG.^2.*m_CG.^2.*w_CG.^2-E_CG.*S_CG.^2.*thetai_CG.*tmax_CG.^2.*xd_CG.*2.4e+1+E_CG.*S_CG.^2.*thetak_CG.*tmax_CG.^2.*xd_CG.*2.4e+1).^6)./1.39314069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.^3.*2.4e+1-E_CG.*Leq_CG.^2.*m_CG.^2.*w_CG.^2-E_CG.*S_CG.^2.*thetai_CG.*tmax_CG.^2.*xd_CG.*2.4e+1+E_CG.*S_CG.^2.*thetak_CG.*tmax_CG.^2.*xd_CG.*2.4e+1).^2)./1.0368e+4]
%Now call t80_FASE and t80_CG in a loop with the input parameters of your choice.
sol(1:3) = t80_FASE(rand,rand,rand,rand,rand,rand,rand,rand,rand)
sol =
0.9809 + 0.0000i -0.0880 - 0.4060i -0.0880 + 0.4060i
%and select the real root(s)
sol = sol(abs(imag(sol))<1e-6)
sol = 0.9809
if ~isdeployed()
syms t80
syms thetai_FASE1 xd_FASE1 E_FASE1 w_FASE1 Leq_FASE1 S_FASE1 thetak_FASE1 tmax_FASE1 m_FASE1
syms thetai_CG1 xd_CG1 E_CG1 w_CG1 Leq_CG1 S_CG1 thetak_CG1 tmax_CG1 m_CG1
eq_FASE= thetai_FASE1+(t80/(xd_FASE1*E_FASE1))-((w_FASE1^2*Leq_FASE1^2)/(24*xd_FASE1*S_FASE1^2*t80^2)) == thetak_FASE1 +(tmax_FASE1/(xd_FASE1*E_FASE1))-((m_FASE1^2*w_FASE1^2*Leq_FASE1^2)/(24*xd_FASE1*S_FASE1^2*tmax_FASE1^2));
eq_CG= thetai_CG1+(t80/(xd_CG1*E_CG1))-((w_CG1^2*Leq_CG1^2)/(24*xd_CG1*S_CG1^2*t80^2)) == thetak_CG1 +(tmax_CG1/(xd_CG1*E_CG1))-((m_CG1^2*w_CG1^2*Leq_CG1^2)/(24*xd_CG1*S_CG1^2*tmax_CG1^2));
t80_FASE = solve(eq_FASE,t80,'MaxDegree',3);
t80_FASE = matlabFunction(t80_FASE)
t80_CG = solve(eq_CG,t80,'MaxDegree',3);
t80_CG = matlabFunction(t80_CG);
end
E_FASE1=E_FASE;
S_FASE1=S_FASE;
thetai_FASE1=thetai_FASE;
tmax_FASE1=tmax_FASE;
w_FASE1=w_FASE;
xd_FASE1=xd_FASE;
E_CG1=E_CG;
S_CG1=S_CG;
thetai_CG1=thetai_CG;
tmax_CG1=tmax_CG;
w_CG1=w_CG;
xd_CG1=xd_CG;
for i=1:t
Leq_FASE1=Leq_FASE(i);
m_FASE1=m_FASE(i);
thetak_FASE1=thetak_FASE(i);
Leq_CG1=Leq_CG(i);
m_CG1=m_CG(i);
thetak_CG1=thetak_CG(i);
sol(1:3) = t80_FASE(E_FASE1,Leq_FASE1,S_FASE1,m_FASE1,thetai_FASE1,thetak_FASE1,tmax_FASE1,w_FASE1,xd_FASE1);
idx_FASE=sol>0;
ti_FASE(i)=real(sol(idx_FASE))
T_FASE(i)=double(ti_FASE(i)*S_FASE);
p_FASE(i)=double(T_FASE(i)/w_FASE);
sol(1:3) = t80_CG(E_CG1,Leq_CG1,S_CG1,m_CG1,thetai_CG1,thetak_CG1,tmax_CG1,w_CG1,xd_CG1);
idx_CG=sol>0;
ti_CG(i)=real(sol(idx_CG))
T_CG(i)=double(ti_CG(i)*S_FASE);
p_CG(i)=double(T_CG(i)/w_FASE);
end
This code worked when running on appdesigner, but then when I compilled it didn't work. (I also tried without if ~isdeployed(), same result)
Can you please help ?
if ~isdeployed()
syms t80
syms thetai_FASE1 xd_FASE1 E_FASE1 w_FASE1 Leq_FASE1 S_FASE1 thetak_FASE1 tmax_FASE1 m_FASE1
syms thetai_CG1 xd_CG1 E_CG1 w_CG1 Leq_CG1 S_CG1 thetak_CG1 tmax_CG1 m_CG1
eq_FASE= thetai_FASE1+(t80/(xd_FASE1*E_FASE1))-((w_FASE1^2*Leq_FASE1^2)/(24*xd_FASE1*S_FASE1^2*t80^2)) == thetak_FASE1 +(tmax_FASE1/(xd_FASE1*E_FASE1))-((m_FASE1^2*w_FASE1^2*Leq_FASE1^2)/(24*xd_FASE1*S_FASE1^2*tmax_FASE1^2));
eq_CG= thetai_CG1+(t80/(xd_CG1*E_CG1))-((w_CG1^2*Leq_CG1^2)/(24*xd_CG1*S_CG1^2*t80^2)) == thetak_CG1 +(tmax_CG1/(xd_CG1*E_CG1))-((m_CG1^2*w_CG1^2*Leq_CG1^2)/(24*xd_CG1*S_CG1^2*tmax_CG1^2));
t80_FASE = solve(eq_FASE,t80,'MaxDegree',3);
t80_FASE = matlabFunction(t80_FASE)
t80_CG = solve(eq_CG,t80,'MaxDegree',3);
t80_CG = matlabFunction(t80_CG);
end
E_FASE1=E_FASE;
S_FASE1=S_FASE;
thetai_FASE1=thetai_FASE;
tmax_FASE1=tmax_FASE;
w_FASE1=w_FASE;
xd_FASE1=xd_FASE;
E_CG1=E_CG;
S_CG1=S_CG;
thetai_CG1=thetai_CG;
tmax_CG1=tmax_CG;
w_CG1=w_CG;
xd_CG1=xd_CG;
for i=1:t
Leq_FASE1=Leq_FASE(i);
m_FASE1=m_FASE(i);
thetak_FASE1=thetak_FASE(i);
Leq_CG1=Leq_CG(i);
m_CG1=m_CG(i);
thetak_CG1=thetak_CG(i);
sol = t80_FASE(E_FASE1,Leq_FASE1,S_FASE1,m_FASE1,thetai_FASE1,thetak_FASE1,tmax_FASE1,w_FASE1,xd_FASE1);
sol = sol(abs(imag(sol))<1e-6 & real(sol)>0)
if numel(sol) ~= 1
display('Error')
end
ti_FASE(i)=sol;
T_FASE(i)=ti_FASE(i)*S_FASE1);
p_FASE(i)=T_FASE(i)/w_FASE1;
sol = t80_CG(E_CG1,Leq_CG1,S_CG1,m_CG1,thetai_CG1,thetak_CG1,tmax_CG1,w_CG1,xd_CG1);
sol = sol(abs(imag(sol))<1e-6 & real(sol)>0)
if numel(sol) ~= 1
display('Error')
end
ti_CG(i)=sol;
T_CG(i)=ti_CG(i)*S_CG1;
p_CG(i)=T_CG(i)/w_CG1;
end
After the aplication compilation this message still appears and it doesn't work.
"syms" are excluded from packaging for the MATLAB Runtime environment according to the MATLAB Compiler license.
When you use matlabFunction in this situation you need to specify 'file' (and 'optimize', 'false') and the else clause needs to create the function handle from the stored file. Nothing after the ~isdeployed test should refer to any symbolic expression or variable.
Thank you guys for the help. I finally understood . Sorry for time wasted.
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Assumptions 的更多信息
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!选择网站
选择网站以获取翻译的可用内容,以及查看当地活动和优惠。根据您的位置,我们建议您选择:。
您也可以从以下列表中选择网站:
如何获得最佳网站性能
选择中国网站(中文或英文)以获得最佳网站性能。其他 MathWorks 国家/地区网站并未针对您所在位置的访问进行优化。
美洲
- América Latina (Español)
- Canada (English)
- United States (English)
欧洲
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
