How can put the values inside tolerances?
Afficher commentaires plus anciens
for i=1:length(As1)
[vq]=dd(Vs1,As1(i));
As = vq.*(Us(j).^2)./(16.*(pi.^2).*msksi.*fs1(j));
res1=As1(i)-As;
if abs(res1)<0.01
As1(i)=As;
Us(j)=Vs.*fs(j);
break
end
11 commentaires
theintern
le 19 Oct 2017
KL
le 19 Oct 2017
and what is digdata2? If you have problems with fs1, you should trace it back there, I suppose.
theintern
le 19 Oct 2017
Rik
le 19 Oct 2017
This is not a free private consultancy forum. It is frowned upon to remove a question once you have a solution. It is really rude to do so. If you want to keep solutions to your problems private, hire a private consultant.
Jan
le 19 Oct 2017
@theintern: Your excuse is welcome. Thanks for this. You have learned now, that deleting question is disliked massively here for good reasons. But it can happen, that you have published something without knowing, that it is a private property. Nevertheless, this is the world wide web, not a playground. You can still find the removed details in e.g. Google'c cache. It is not a secret that internet users have to think at least twice, before they publish anything.
Remember, that you agreed to the terms of use. Read it again, the part "Contents" is important here. The admins and editors can restore your question, and if you do not provide a good reasons and excuse, they will.
Please replace "deleted" by a short statement, which calms down Rik and convinces e.g. me not to restore the original question. But the admins and other editors will decide by their own.
theintern
le 19 Oct 2017
Jan
le 20 Oct 2017
My opinion: Okay. @Rik: Perhaps you want to remove the flag now?
I have removed the equations and replaced them with dummy functions.
@theintern: No hard feelings, this is an open forum and we are all volunteers here just because we like what we do and to share the knowledge and learn together.
These things can happen, not to mention you'd have been stressed to finish your task before the deadline. You have posted your question with fairly decent descriptions (compared to homework questions which we see on daily basis) with whatever you've tried. But next time, if the code is not allowed to be posted online, try to emulate it as a minimal problem so we can understand your original situation and help you. Good luck!
Rik
le 20 Oct 2017
I agree with Jan and KL. Sweating it is never nice, so you should learn from it, which I think you did.
Réponse acceptée
Plus de réponses (1)
Rik
le 19 Oct 2017
What do you mean, it doesn't stop? These are for-loops, so they will exit. Do you mean you want to break out of both loops at the same time? If that is the case, the code structure below should help.
BreakLoop=false;
for i=1:length(As1)
if BreakLoop,break,end
for j=1:length(fs1)
...
if abs(res1)<0.01 && abs(res2)<0.01
BreakLoop=true;
break
end
end
end
1 commentaire
theintern
le 19 Oct 2017
Catégories
En savoir plus sur Programming dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!