dimanche 24 juillet 2016

matlab make IF decide writing someting inside a function

I have these unknowns and equations: u1,u2,...u10 and eq1,eq2,...eq10. I am currently solving them using vpasolve Usually they are worth calculating, but sometimes their values are so low (<0.0001) that I would like to eliminate them, and after vpasolve solves the rest (some 10 minutes) I should verify if it was wrong or not to eliminate the unknowns.

So this would mean something like:

verif=zeros(10); %false value for removing unknowns
syms if verif(1)=0
write 'u1'
end

... and so on for every 10 unknowns. vpasolve would have a similar way of deciding if the unknowns and equations are written. This is the place that I should check it removing was OK. And this is the place where the <0.0001 decision is made:

if u1<0.0001
verif(1)=1;

My problem is that I don't know how to correctly write the first code and how to do it more easily for 100 unknowns (something like a for loop).

Aucun commentaire:

Enregistrer un commentaire