Afficher commentaires plus anciens
y=@(T) I*T*sind(A)-(0.5*G*(T^2));
root = fzero(y, 0)
abouve eqation is for a projectile that projected at an angle (gose in a kind of ar half oval shape)
want to find the time it hist ground but fzero only gives me the biginning which is 0
23 commentaires
Walter Roberson
le 24 Fév 2011
Maybe it just doesn't like buxZED... won't let me submit an answer to this one.
Walter Roberson
le 24 Fév 2011
root = fzero(y,[eps, realmax])
buxZED
le 24 Fév 2011
Paulo Silva
le 24 Fév 2011
Hey Walter, answers stop working for me too :(
We're sorry, but something went wrong.
We've been notified about this issue and we'll take a look at it shortly.
buxZED
le 24 Fév 2011
buxZED
le 24 Fév 2011
Matt Fig
le 24 Fév 2011
Plot the function, look at the plot and pick a closer guess than zero.
buxZED
le 24 Fév 2011
Matt Fig
le 24 Fév 2011
You do realize that FZERO is a numerical root finder, right?
buxZED
le 24 Fév 2011
Walter Roberson
le 24 Fév 2011
Ummm, make it fzero(y,[eps,sqrt(realmax)/G]
Using fzero(y,eps,realmax) would cause realmax to be interpreted as an Option, and then it would use eps as the starting guess, not constrained from going backwards.
Walter Roberson
le 24 Fév 2011
No, there is no way to force fzero to go to the next positive root. You can only exclude the area you already searched from the area fzero is to search next.
Matt Fig
le 24 Fév 2011
rt = 0;
d = .1;
cnt = 1;
while ~rt
rt = fzero(y,rt+d*cnt);
cnt = cnt + 1;
end
buxZED
le 24 Fév 2011
Walter Roberson
le 24 Fév 2011
~ is logical negation. It is true if and only if the thing being tested is exactly 0.
buxZED
le 24 Fév 2011
Matt Fig
le 24 Fév 2011
When rt is not zero, then ~rt is false. That would stop the WHILE loop.
buxZED
le 24 Fév 2011
buxZED
le 24 Fév 2011
Matt Fig
le 24 Fév 2011
Change from:
while ~rt
to:
while rt<.1
or similar. It might help if you actually gave us some values for I, A and G.
buxZED
le 24 Fév 2011
Matt Tearle
le 25 Fév 2011
Can I suggest using an initial guess of 2*I*sind(A)/G? Just sayin'...
Matt Fig
le 25 Fév 2011
Come on now, Matt! Where is the fun of solving the equation with your brain instead of making MATLAB do it?
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Student's t Distribution 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!