matlab - Matlab中的输出方向(水平到垂直)
问题描述
以下 Matlab 代码有效,但我希望输出采用列格式而不是行格式。最终,我希望 Matlab 最后输出一个表格。这将是变量 abn dt it(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.
谢谢。毫米
解决方案
推荐阅读
- windows - GIT 预提交钩子,它在修改/添加的文件中搜索非 UTF-8 编码(如果找到则拒绝提交)
- qt - QT Data Visualization in ROS Workspace Issue
- r - 使用`ddply`从两列中选择基于匹配对的列的最常见值
- javascript - 在 React 中使用 Array.Map() 返回子数组
- r - 比较两个大数据帧的内存有效方法是什么
- php - 我在 laravel 查询语言中遇到错误
- emacs - Cider-connect to already running REPL with figwheel
- java - 如何将两个表的数据合二为一?
- java - Spring @PostConstruct 执行顺序?
- jasmine - 量角器中的失败测试停止了其余测试用例的执行