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

13 次查看(过去 30 天)
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