MATLAB: Why the command window does not show anything,just the title only. here is the coding

euler

%% Euler simple method close all clear all clc % f(x) = -0.5x^4+4x^3-10x^2+8.5x+1; need to find the derivative f= @(x) (-0.5*x.^4)+(4*x.^3)-(10*x.^2)+(8.5*x)+1; df = @(x) (-2*x.^3)+(12*x.^2)-(20*x)+8.5; xint = 0; xend = 4; %Interval h =0.5; %step size yint = 1; %Initial condition x=0, y=1 x = (xint:h:xend)'; ytrue = f(x); sh = df(x)*h; % f(xi,yi)h (slope*h) yeuler = yint; for i= 2:xend*2 yeuler(i) =sh(i-1)+ yeuler(i-1); end

Best Answer

Read this link to fix your formatting.
Leave the semicolon off any line that you want to report the result to the command window.