Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Please help !! Lagrange polynomial reconstruction

Status
Not open for further replies.

letterbox

Newbie
Joined
Mar 30, 2009
Messages
4
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,308
polynomial reconstruction in matlab

Hi,

I am facing some difficulties with Matlab code for Lagrange polynomial reconstruction.

from the file do_lagranp.m attached:
------------------------------------------
%do_lagranp.m
x = [1 2 3 4 5 6 7 8 9];

res = zeros(size(x));

for i = 1:9
res(i) = 512*x(i)^8 + 102*x(i)^7 + 1024*x(i)^6 + 806*x(i)^5 + ...
216*x(i)^4 + 117*x(i)^3 + 126*x(i)^2 + 132*x(i) + 41584;
end

y = res;

l = lagranp(x,y) %Find the lagrange polynomial
coef = round(l)

----------------------------------------------------------
If I were to use the x values as shown x = [1 2 3 4 5 6 7 8 9], then the code will have no problem in reconstructing the polynomial res by returning the exact coefficients [512 102 1024 806 216 117 .....]

But if I change the x values to something bigger, may be x = [100 200 300 ....],
then the code will not return the correct coefficients anymore.

Can someone please help me? Is there a maximum number that Matlab can only work on? What can I do to solve this issue because I really need the input for data x to be big value.

Thank you!!!
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top