Matlab中的输出方向(从水平到垂直)

Matlab中的输出方向(从水平到垂直),matlab,output,Matlab,Output,下面的Matlab代码可以工作,但我希望输出是列格式而不是行格式。最后,我希望Matlab在最后输出一个表。这将是变量a b n dt i t(i)y(i)的迭代历史 怎么办 % Euler Method dy/dt=f(t,y)=sin(t^2)*sqrt(y) f=@(t,y)(sin(t^2)*sqrt(y)) t(1)=1; y(1)=1; a=1; b=3; n=10; dt=(b-a)/n; for i=1:1:n y(i+1)=y(i)+f(t(i),y(i)) t(i+1)=t

下面的Matlab代码可以工作,但我希望输出是列格式而不是行格式。最后,我希望Matlab在最后输出一个表。这将是变量a b n dt i t(i)y(i)的迭代历史

怎么办

% Euler Method dy/dt=f(t,y)=sin(t^2)*sqrt(y)
f=@(t,y)(sin(t^2)*sqrt(y))
t(1)=1;
y(1)=1;
a=1;
b=3;
n=10;
dt=(b-a)/n;

for i=1:1:n
y(i+1)=y(i)+f(t(i),y(i))
t(i+1)=t(i)+dt;
end

I want to transpose the output (horizontal to vertical columns of t and y                        
side by side as opposed to a long column of t concatenated by y below.

[t y]' does the latter.

谢谢。嗯

也许你的意思是
[t y]'
可能的重复,那么也许你的意思是
[t;y]'