Unable to perform assignment because the left and right sides have a different number of elements.
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
I`m new in this, but im trying to solve a problem with euler`s method and appears this as an error.
C= 100;
D= 0.1;
b= 0.15;
m= 0.05;
g= 9.81;
vo=0;
yo=0;
% Euler's Method
% Initial conditions and setup
h = 0.001; % step size
x = 0.001:h:5; % the range of x
y = zeros(size(x)); % allocate the result y
y(1) = 0; % the initial y value
n = numel(y); % the number of y values
% The loop to solve the DE
for i=1:n-1
f = C*(dt/m)*(D-yo)-(g*dt)+(vo*(1-(b*dt)/m))
y(i+1) = y(i) + h * f;
end
plot(x,y); grid on
COMMAND WINDOW
Unable to perform assignment because the left and right sides have a different number of elements.
Error in EulerMethod (line 20)
y(i+1) = y(i) + h * f;
2 Kommentare
KSSV
am 19 Okt. 2020
Show us the wholde code....you will not get such error, when you run the give code.....
You have to define dt.....once you define dt..code runs smooth.
Antworten (0)
Siehe auch
Kategorien
Mehr zu Argument Definitions finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!