what is the probleme exactly u must be of size[3,20] but i find it [3,1]

1 view (last 30 days)
function [u] = suite(A,b,u1,nb)
[n,n] = size(A);
u=u1;
for i = 1 : nb
u= A*u +b;
end
end
A=[5/8 -1/4 1/8;1/4 0 1/4;1/8 -1/4 5/8];b=[1;-1;1];u1=[5;2;-4];m=20;p=m;
u=suite(A,b,u1;b)

Answers (1)

Jan
Jan on 12 Jan 2021
Let me guess boldly: You want:
A = [5/8, -1/4, 1/8; 1/4, 0, 1/4; 1/8, -1/4, 5/8];
b = [1;-1;1];
u = [5; 2; -4];
m = 20;
u = suite(A, b, u, m)
function u = suite(A, b, u, m)
for i = 1 : m
u = A*u + b;
end
end

Community Treasure Hunt

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

Start Hunting!