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

13 vues (au cours des 30 derniers jours)
Nicole Teal
Nicole Teal le 2 Oct 2018
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

Réponses (0)

Catégories

En savoir plus sur Matrices and Arrays dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by