Help with polynomial and least square method

Me and my friends got this assignment and we have no idea on how to solve it, anyone knows where to start, could solve it or have the code for something similar?
Any help is appreciated!
Thanks!
3) For the function f, we have the following values in the table:
(see table .png)
a)Adapt the modell p(t)=(a2)*t^2+(a1)*t +(a0) to its functional value using the least square method.
b)Assume the functional value in t=0 is exact and adapt the modified modell p(t)=(b2)*t^2 +(b1)*t +1 to its functional value
c)Plot the dots in the table and the two graps of the adapted modells in a singel figure. Discuss which modell is the best
d) Calculate the weighted error
(See Equation.png)
for the polynomial in a) and b). Does the result confirm your answer in c)?
e)Find a polynomial of the least possible degree that has the property of all dots in the table being on the polynomial graph. What degree does the polynomial have?

댓글 수: 3

Since this is a homework assignment, show us the code you've written to try to solve the problem and ask a specific question about where you're having difficulty and we may be able to provide some guidance.
If you aren't sure where to start because you're not familiar with how to write MATLAB code, I suggest you start with the MATLAB Onramp tutorial (https://www.mathworks.com/support/learn-with-matlab-tutorials.html) to quickly learn the essentials of MATLAB.
If you aren't sure where to start because you're not familiar with the mathematics you'll need to solve the problem, I recommend asking your professor and/or teaching assistant for help.
freddie P
freddie P 2020년 2월 7일
편집: freddie P 2020년 2월 7일
We have solved 3A and 3B like the code bellow, we are pretty sure A is correct but we are unsure of B) they want us to assume the functional value in t=0 is exact and adapt the modified modell p(t)=(b2)*t^2 +(b1)*t +1 to its functional value. Have we done B right?
format long
clear
clc
%a)
A = [1 1 1 1 1; -0.4 0 0.4 0.8 1.2; 0.16 0 0.16 0.64 1.44];
A_vert = [1 -0.4 0.16; 1 0 0; 1 0.4 0.16; 1 0.8 0.64; 1 1.2 1.44];
left = mtimes(A,A_vert);
inv_left = inv(left);
B = [0.8951; 1; 0.9345; 0.8088; 0.6626];
right = mtimes(A,B);
konsts = mtimes(inv_left,right);
f = @(t) konsts(3,1)*t^2 + konsts(2,1)*t + konsts(1,1);
f(-0.4)
f(0)
f(0.4)
f(0.8)
f(1.2)
%____________________________________________________________________________________
%B)
A = [1 1 1 1 1; -0.4 0 0.4 0.8 1.2; 0.16 0 0.16 0.64 1.44];
A_vert = [1 -0.4 0.16; 1 0 0; 1 0.4 0.16; 1 0.8 0.64; 1 1.2 1.44];
left = mtimes(A,A_vert);
inv_left = inv(left);
B = [0.8951; 1; 0.9345; 0.8088; 0.6626];
right = mtimes(A,B);
konsts = mtimes(inv_left,right);
f = @(t) konsts(3,1)*t^2 + konsts(2,1)*t + 1;
f(-0.4)
f(0)
f(0.4)
f(0.8)
f(1.2)

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

도움말 센터File Exchange에서 Polynomials에 대해 자세히 알아보기

제품

질문:

2020년 2월 7일

편집:

2020년 2월 7일

Community Treasure Hunt

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

Start Hunting!

Translated by