matlab is taking too long to solve the equation.

4 vues (au cours des 30 derniers jours)
MANOJ KUMAR
MANOJ KUMAR le 21 Oct 2020
while (FSt~=FSo)
FSo = FSt
Nu = W +(T.*sina)-(((p.*l.*sint) - (u.*l.*tanp.*sint))./FSo)
Nb = cost + (tanp.*sint)./FSo
N = Nu./Nb
up = sum((p*l*R)) + sum((N.*tanp*R)) - sum((u.*l*tanp*R))+sum(((FSo.*T*(R.*cosaw))))
down = sum(W.*xavg)
FSt = up/down %FOS after reinforcement%%
g=FSt-1
dp=diff(g,p);
p1=subs(dp,{p q r T},{C Gama Phi Tf});
p2=double(p1)
dq=diff(g,q);
q1=subs(dq,{p q r T},{C Gama Phi Tf});
q2=double(q1)
dr=diff(g,r);
r1=subs(dr,{p q r T},{C Gama Phi Tf});
r2=double(r1)
dT=diff(g,T);
T1=subs(dT,{p q r T},{C Gama Phi Tf});
T2=double(T1)
sums=double((p2*sig_tr_c)^2+(q2*sig_tr_gama)^2+(r2*sig_tr_phi)^2+(T2*sig_tr_T)^2)
c_prime= mu_tr_c-((p2*sig_tr_c)/sqrt(sums))*2*sig_tr_c;
gama_prime= mu_tr_gama-((q2*sig_tr_gama)/sqrt(sums))*2*sig_tr_gama; %here beta target =2
phi_prime = mu_tr_phi-((r2*sig_tr_phi)/sqrt(sums))*2*sig_tr_phi;
eq=subs(g,{p q r},{c_prime gama_prime phi_prime})
sol=vpasolve(eq==0,T)
end
end

Réponses (1)

Saurav Chaudhary
Saurav Chaudhary le 28 Oct 2020
For this I would like to suggest running ''Profiler'' on your code as workaround.
To know more about profiling refer below points:
  • Profiling is a way to measure the time it takes to run your code and identify where MATLAB spends the most time.
  • After you identify which functions are consuming the most time, you can evaluate them for possible performance improvements.
  • You also can profile your code to determine which lines of code do not run.
You can refer this documentation link to see how to run profiler on your code-
You can also refer this link to look at some of the techniques that may help you improve performance-

Catégories

En savoir plus sur Manual Performance Optimization dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by