I'm taking a course on numerical methods using MATLAB, and right now we're discussing linear systems. This is the question I was given.(adsbygoogle = window.adsbygoogle || []).push({});

P(x) = (3/2)x^2 - 1/2

Q(x) = (5/2)x^3 - (3/2)x

Compute vectors P and Q using the following MATLAB commands.

X = -1:1/500:1;

N = length(X);

P = p(1)*X.^2 + p(2)*X + p(3)*1;

Q = q(1)*X.^3 + q(2)*X.^2 + q(3)*X + q(4);

Where p and q are the coefficient vectors of the polynomials P(x) and Q(x).

Compute and give the numerical result for:

(The sum from i=1 to N) of (Pi Pi)

(The sum from i=1 to N) of (Pi Qi)

(The sum from i=1 to N) of (Qi Qi)

What linear algebra operation is this? Express your answer in vector notation.

Based on the results of the above summations, what can we infer about P and Q and why?

I'm fine all the way up to the linear algebra questions.

I understand that X is a vector containing 1001 evenly spaced numbers between -1 and 1, and so vectors P and Q are vectors containing 1001 values of the functions P(x) and Q(x) respectively within the range x=-1 to x=1.

As for the summations, I'm using sum(P.*P) and the like to get these three sums (in order):

201.0020

-2.4425e-015

143.8611

So what linear algebra operation is this? I first thought of integration, since it's a summation of a function across a range of x values, but that's not linear algebra. I don't ever recall individual squaring the entries of a vector in first year lin alg. The statement "express your answer in vector notation" suggests that the three sums make up a notable 3x1 vector, but again, I'm completely at a loss.

Did I do the summation wrong, or do I just need to brush up on linear algebra? Help!

**Physics Forums - The Fusion of Science and Community**

Dismiss Notice

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# A bit of MATLAB, a bit of linear algebra

Loading...

Similar Threads for MATLAB linear algebra | Date |
---|---|

MATLAB A question on linear algebra(also Matlab related) | Jun 23, 2014 |

Polymath or Matlab non-linear algebraic solver | Oct 11, 2013 |

MATLAB Linear Algebra problem solved in MATLAB | Jul 3, 2012 |

MATLAB Can someone suggest anything cool i can do on Matlab about linear algebra? | Jun 16, 2011 |

Linear Algebra Matlab Help | Mar 16, 2008 |

**Physics Forums - The Fusion of Science and Community**