How do I let a initial vector change depending on input?

조회 수: 13 (최근 30일)
Nicole Teal
Nicole Teal 2018년 10월 2일
I want to display a table for error solutions to a Hilbert matrix n=5-13. I initialized a ones vector but it will not accept a change in size even inside a for loop. Here is a sample of my code:
function T=object(n)
for i=1:length(n)
A=hilb(n(i));
x_true=ones(n(i),1);
b=A.*x_true;
%List of variables for the table. Reiterate to avoid overwriting.
n=n(i);
for j=1:length(n)
var1=something
end
for j=1:length(n)
var2=something
end
for j=1:length(n)
var3=something
end
T=table(n,var1,var2,var3);
summary(T)
end
end

답변 (0개)

카테고리

Help CenterFile Exchange에서 Matrices and Arrays에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by