Filter löschen
Filter löschen

how do i fix this Unable to perform assignment because the left and right sides have a different number of elements.

1 Ansicht (letzte 30 Tage)
x(i+1) = x(i) + h;
% euler forward
ye= y0+h*f(x0,y0);
f_newton = @(yvar) yvar-y-h*f(x(i+1),yvar);
df_newton = @(yvar) 1-h*dfdy(x(i+1),yvar);
y(i+1) = NewtonsMethod(f_newton, df_newton,ye, tol);

Antworten (1)

Prasad Parameswaran
Prasad Parameswaran am 22 Okt. 2019
This is because of dimension mismatch. This can be resolved by initialiszing the variables. If the dimension of variable(say x) is known (for example m x n) initiallize " x = zeros(m,n)". Do this for all the variables. If not able to solve the issue share the whole code.

Kategorien

Mehr zu Matrix Indexing 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!

Translated by