Fzero function errors in matlab

14 vues (au cours des 30 derniers jours)
Ho-Wei LIU
Ho-Wei LIU le 7 Oct 2021
xN = zeros(1,Niter); % dispalcemant analytical
dxN = zeros(1,Niter); % dispalcemant_dot analytical
ddxN = zeros(1,Niter); % dispalcemant_double_dot analytical
xN(1) = x0; % initial displacement
xN(2) = x0 + v0*dt; % displacement at iteration 2
dxN(1) = v0; %initial vel
dxN(2) = v0;
Const_drag = 0.5*Cd*p*A;
Const_lift = 0.5*Cl*p*A;
for i = 3:Niter
xNOW = xN(i-1);
xPRE = xN(i-2);
f = @(xNEX) ...
m * (xNEX - 2*xNOW + xPRE)/(dt^2)...
+ 0.5 * Const_drag * ((xNEX-xPRE)/(2 * dt))...
+ (-0.0001 * (w + Const_lift * ((xNEX-xPRE)/(2 * dt))^2)^2)...
+ 1.6 * (w + Const_lift * ((xNEX-xPRE)/(2 * dt)) ^ 2);
xNEX = fzero(f, xNOW);
xN(i) = xNEX;
dxN(i) = (xNEX - xPRE)/(2*dt);
end
% xNEX = fzero(f, xNOW); this line keep showing errors but i could not figure out
  1 commentaire
Shravan Kumar Vankaramoni
Shravan Kumar Vankaramoni le 11 Oct 2021
Can you provide the error message thrown on that line?

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Problem-Based Optimization Setup dans Help Center et File Exchange

Tags

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by