My code for MatLab is saying, "Unable to perform assignmentbecause the left and right sides have a different number ofelements." for Line 11 in the for loop. I don't know what I'm doingwrong.
tFinal = 5;
N = 1200;
h=tFinal/N;
t=linspace(0,tFinal,N+1); % type 'help linspace' to see how thisworks
x=zeros(1,N+1);
xExact= (10*(t+1).^(8))/((t+1).^(10)+9);
x(1) = 1; % setting the initial condition
for n=1:N
x(n+1) = x(n) + h * [(8*x(n))-(t+1)]-[(t+1)*x(n).^(2)];<---------------- I get the error msg here
end
plot(t,x,t,xExact,'--')
xlabel('t'); ylabel('y'); title('Problem 1!');
没有找到相关结果