Azzera filtri
Azzera filtri

Info

Questa domanda è chiusa. Riaprila per modificarla o per rispondere.

How to put this information is a table?

1 visualizzazione (ultimi 30 giorni)
Todd
Todd il 2 Dic 2013
Chiuso: MATLAB Answer Bot il 20 Ago 2021
Hey I was wondering what command I would need to use to put all of this produced data in table or chart?
%Number 1 and 2
clear;
x0=[42;0;95];
extinct=0;
W=zeros(1,200);
for N= 1:10
F=2*rand(1);
for t=1:200;
W(t)=F;
A=[0 0 F; .6 0 0; 0 .75 .55];
x=(A^t)*x0;
if (sum(x)<1);
extinct=extinct+1;
break;
end
end
end
fprintf('#2 Number of extinction events for N=10 n=%d\n', extinct)
clear;
x0=[42;0;95];
extinct=0;
W=zeros(1,200);
for N= 1:20
F=2*rand(1);
for t=1:200;
W(t)=F;
A=[0 0 F; .6 0 0; 0 .75 .55];
x=(A^t)*x0;
if (sum(x)<1);
extinct=extinct+1;
break;
end
end
end
fprintf('#2 Number of extinction events for N=20 n=%d\n', extinct)
clear;
x0=[42;0;95];
extinct=0;
W=zeros(1,200);
for N= 1:50
F=2*rand(1);
for t=1:200;
W(t)=F;
A=[0 0 F; .6 0 0; 0 .75 .55];
x=(A^t)*x0;
if (sum(x)<1);
extinct=extinct+1;
break;
end
end
end
fprintf('#2 Number of extinction events for N=50 n=%d\n', extinct)
clear;
x0=[42;0;95];
extinct=0;
W=zeros(1,200);
for N= 1:100
F=2*rand(1);
for t=1:200;
W(t)=F;
A=[0 0 F; .6 0 0; 0 .75 .55];
x=(A^t)*x0;
if (sum(x)<1);
extinct=extinct+1;
break;
end
end
end
fprintf('#2 Number of extinction events for N=100 n=%d\n', extinct)
clear;
x0=[42;0;95];
extinct=0;
W=zeros(1,200);
for N= 1:200
F=2*rand(1);
for t=1:200;
W(t)=F;
A=[0 0 F; .6 0 0; 0 .75 .55];
x=(A^t)*x0;
if (sum(x)<1);
extinct=extinct+1;
break;
end
end
end
fprintf('#2 Number of extinction events for N=200 n=%d\n', extinct)
clear;
x0=[42;0;95];
extinct=0;
W=zeros(1,200);
for N= 1:500
F=2*rand(1);
for t=1:200;
W(t)=F;
A=[0 0 F; .6 0 0; 0 .75 .55];
x=(A^t)*x0;
if (sum(x)<1);
extinct=extinct+1;
break;
end
end
end
fprintf('#2 Number of extinction events for N=500 n=%d\n', extinct)
  2 Commenti
sixwwwwww
sixwwwwww il 2 Dic 2013
Values of which variables you want to put in a table? Can you specify?
Todd
Todd il 2 Dic 2013
Modificato: Todd il 2 Dic 2013
The number of extinction events at each N range, I used the fprintf function to have matlab display them but I couldn't figure out how to make matlab put the resulting values into a table

Risposte (1)

sixwwwwww
sixwwwwww il 2 Dic 2013
Modificato: sixwwwwww il 2 Dic 2013
Dear Todd, just do as follows:
count = 1;
%Number 1 and 2
x0=[42;0;95];
extinct=0;
W=zeros(1,200);
for N= 1:10
F=2*rand(1);
for t=1:200;
W(t)=F;
A=[0 0 F; .6 0 0; 0 .75 .55];
x=(A^t)*x0;
if (sum(x)<1);
extinct=extinct+1;
break;
end
end
Matrix(count, 1) = N;
Matrix(count, 2) = extinct;
count = count + 1;
end
fprintf('#2 Number of extinction events for N=10 n=%d\n', extinct)
x0=[42;0;95];
extinct=0;
W=zeros(1,200);
for N= 1:20
F=2*rand(1);
for t=1:200;
W(t)=F;
A=[0 0 F; .6 0 0; 0 .75 .55];
x=(A^t)*x0;
if (sum(x)<1);
extinct=extinct+1;
break;
end
end
Matrix(count, 1) = N;
Matrix(count, 2) = extinct;
count = count + 1;
end
fprintf('#2 Number of extinction events for N=20 n=%d\n', extinct)
x0=[42;0;95];
extinct=0;
W=zeros(1,200);
for N= 1:50
F=2*rand(1);
for t=1:200;
W(t)=F;
A=[0 0 F; .6 0 0; 0 .75 .55];
x=(A^t)*x0;
if (sum(x)<1);
extinct=extinct+1;
break;
end
end
Matrix(count, 1) = N;
Matrix(count, 2) = extinct;
count = count + 1;
end
fprintf('#2 Number of extinction events for N=50 n=%d\n', extinct)
x0=[42;0;95];
extinct=0;
W=zeros(1,200);
for N= 1:100
F=2*rand(1);
for t=1:200;
W(t)=F;
A=[0 0 F; .6 0 0; 0 .75 .55];
x=(A^t)*x0;
if (sum(x)<1);
extinct=extinct+1;
break;
end
end
Matrix(count, 1) = N;
Matrix(count, 2) = extinct;
count = count + 1;
end
fprintf('#2 Number of extinction events for N=100 n=%d\n', extinct)
x0=[42;0;95];
extinct=0;
W=zeros(1,200);
for N= 1:200
F=2*rand(1);
for t=1:200;
W(t)=F;
A=[0 0 F; .6 0 0; 0 .75 .55];
x=(A^t)*x0;
if (sum(x)<1);
extinct=extinct+1;
break;
end
end
Matrix(count, 1) = N;
Matrix(count, 2) = extinct;
count = count + 1;
end
fprintf('#2 Number of extinction events for N=200 n=%d\n', extinct)
x0=[42;0;95];
extinct=0;
W=zeros(1,200);
for N= 1:500
F=2*rand(1);
for t=1:200;
W(t)=F;
A=[0 0 F; .6 0 0; 0 .75 .55];
x=(A^t)*x0;
if (sum(x)<1);
extinct=extinct+1;
break;
end
end
Matrix(count, 1) = N;
Matrix(count, 2) = extinct;
count = count + 1;
end
fprintf('#2 Number of extinction events for N=500 n=%d\n', extinct)

Questa domanda è chiusa.

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by