The Normal Equation and QR My Solutions

2 views (last 30 days)
Doga Ersuz
Doga Ersuz on 19 Jun 2022
Commented: William Rose on 20 Jun 2022
% discretize t on [-2,2] with h=0.01 (as a column vector)
How can I do that?
  6 Comments
Doga Ersuz
Doga Ersuz on 20 Jun 2022
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 on 20 Jun 2022
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

Sign in to comment.

Answers (1)

William Rose
William Rose on 20 Jun 2022
Edited: William Rose on 20 Jun 2022
@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.

Categories

Find more on Programming in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!