Fzero function errors in matlab

15 Ansichten (letzte 30 Tage)
Ho-Wei LIU
Ho-Wei LIU am 7 Okt. 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 Kommentar
Shravan Kumar Vankaramoni
Shravan Kumar Vankaramoni am 11 Okt. 2021
Can you provide the error message thrown on that line?

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Problem-Based Optimization Setup finden Sie in Help Center und File Exchange

Tags

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by