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

13 views (last 30 days)
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

Answers (0)

Categories

Find more on Matrices and Arrays in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!