The Normal Equation and QR My Solutions

2 次查看(过去 30 天)
% discretize t on [-2,2] with h=0.01 (as a column vector)
How can I do that?
  6 个评论
Doga Ersuz
Doga Ersuz 2022-6-20
Thanks for your interest and answer. I'm doing [-2:0.01:2] or (-2:0.01:2)' to create a column vector but it gives error. I'm struggling to understand my mistake.
Torsten
Torsten 2022-6-20
Works for me.
t = (-2:0.01:2)'
t = 401×1
-2.0000 -1.9900 -1.9800 -1.9700 -1.9600 -1.9500 -1.9400 -1.9300 -1.9200 -1.9100

请先登录,再进行评论。

回答(1 个)

William Rose
William Rose 2022-6-20
编辑:William Rose 2022-6-20
@Doga Ersuz, It looks like your professor has provided a partial script in which you must fill in the right hand side on lines 6, 10, and 12. Hints: Line 6 should create a vector that is 401x1 (rows by columns). @Torsten's hint is the key for line 6. Line 10 should create a 401x5 matrix. Line 12 should create a 5x1 vector. You do not need a for loop for any of these lines, which is one of the nice things about Matlab. Line 15 of the script looks like a mistake, for several reasons.

类别

Help CenterFile Exchange 中查找有关 Programming 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by