Lagrange interpolation | Programming Numerical Methods in MATLAB

  Рет қаралды 82,749

mechtutor com

mechtutor com

6 жыл бұрын

Get the ebook of this method and many more with code files on this webpage: mechtutor.thinkific.com/cours...
MATLAB Quick Reference - ebook link: mechtutor.thinkific.com/cours...
The theory and MATLAB programming steps of Lagrange's interpolation method are explained.
*** For a full course of Numerical Methods in Python, visit: www.udemy.com/course/programm...
Visit my new Python course webpage: mechtutor.thinkific.com/cours...
Credits:
Intro Music: Title: "Carefree", source:freemusicarchive.org/music/Ke...

Пікірлер: 51
@equiknox_
@equiknox_ Ай бұрын
Hey, just wanna let you know that I am thankful I found this video. My prof does not even taught us how to code and he expects us on exam that we code things like this on octave. You are really helpful even years have already passed. Thank you!!
@teerachote
@teerachote 3 жыл бұрын
I just getting into all of this Matlab thing and this video explain it crystal clear, Thank you so much!
@tayneilson
@tayneilson 6 жыл бұрын
wish i found this sooner. i bought your materials keep up the good work
@AJ-et3vf
@AJ-et3vf 2 жыл бұрын
Awesome video! Thank you! You're very helpful and your voice is very calming and soothing. Thank you!
@bastianrojo6175
@bastianrojo6175 5 жыл бұрын
Thank you very much, Mr. It helped me a lot. Greetings from Chile
@vma011
@vma011 3 жыл бұрын
Thank you so much! You helped me solve a problem of my numerical methods class. Instead of evaluating a single "xp" value, we needed to plot the resulting polynomial as a function, so I had to vectorize the calculation. I generated a vector xp = linspace( min(x), max(x), 200) and initialized the sum and product variables as vectors with dimension 1x200 . I then used exactly your same algorithm but used point-wise product (.*) and division (./) where needed. I solved the thing in few lines thanks to your code!
@AJ-et3vf
@AJ-et3vf 2 жыл бұрын
Awesome!
@Sojung0714
@Sojung0714 5 жыл бұрын
that's so simple! Thanks a lot!
@shaimashakib6409
@shaimashakib6409 5 жыл бұрын
Thank u so much ! This helped me A LOT :D
@alobyerl7635
@alobyerl7635 3 жыл бұрын
Hi! Thank you for the video, I have one more question, how to generate the plot for that equation?
@bcerme16
@bcerme16 5 жыл бұрын
Thank you very much sir! It helped me a lot
@ismailamdah2937
@ismailamdah2937 5 жыл бұрын
Thank you very very much!
@sagarraj4521
@sagarraj4521 4 жыл бұрын
Thanks a lot sir!!!!
@ritucreativity3889
@ritucreativity3889 3 жыл бұрын
Thank you so much ❤
@sethmcbrown9492
@sethmcbrown9492 6 жыл бұрын
You're awesome bro
@joelelanga4882
@joelelanga4882 3 жыл бұрын
Thank you very much
@sylwiawrzesien518
@sylwiawrzesien518 4 жыл бұрын
Hello thank you for your tutorial. Could you tell me how to plot it ?
@user-ok8wy2vx7b
@user-ok8wy2vx7b 7 ай бұрын
thank you!
@carlospuente3979
@carlospuente3979 2 жыл бұрын
Hey! I have a question: why does pr start at 1? I mean, I know why, but in the code I don't understand why is it there.
@mpixlas4
@mpixlas4 4 жыл бұрын
Great video, thank you very much. I'm trying to figure out how to plot the respective fit... Any thoughts about that?
@mechtutorcom
@mechtutorcom 4 жыл бұрын
Thank you for the comment. The curve can be plotted by adding x array from x0 to xn. The Lagrange interpolation routine should be put inside a for-loop which calculates y-array element corresponding to each x-array element. At the end, two arrays of x and y can be plotted easily with MATLAB plot function. You can find this technique applied at the end of this video of Lagrange interpolation with Python: kzbin.info/www/bejne/moWqooKgZrONrbs
@AJ-et3vf
@AJ-et3vf 2 жыл бұрын
For loops
@DeGameBox_SRBT
@DeGameBox_SRBT 8 ай бұрын
thanks! thanks! thanks! you just saved my studwork! @@mechtutorcom
@oussamaguerroudj9053
@oussamaguerroudj9053 6 жыл бұрын
thank u ^^
@agustinacevedo5932
@agustinacevedo5932 5 жыл бұрын
Excellent work but I have a doubt, if I wanted to know the coefficients of the lagrange polynomial, what should I modify the code that you developed? Thank you
@sophia2928
@sophia2928 4 жыл бұрын
i have the same doubt
@AJ-et3vf
@AJ-et3vf 2 жыл бұрын
You will need a symbolic Computer Algebra System (CAS) in order to do that since the code only works for numerical evaluations and not symbolic manipulation of variables. If you really want the coefficients of the polynomial, use Vandermonde matrix polynomial to solve the problem. However, be aware that the resulting matrix may be ill-conditioned.
@AJ-et3vf
@AJ-et3vf 2 жыл бұрын
You don't have a doubt. You have a question
@AJ-et3vf
@AJ-et3vf 2 жыл бұрын
@@sophia2928 you don't have a doubt. You have a question.
@AJ-et3vf
@AJ-et3vf 2 жыл бұрын
@@sophia2928 You will need a symbolic Computer Algebra System (CAS) in order to do that since the code only works for numerical evaluations and not symbolic manipulation of variables. If you really want the coefficients of the polynomial, use Vandermonde matrix polynomial to solve the problem. However, be aware that the resulting matrix may be ill-conditioned.
@mamtakapoor2600
@mamtakapoor2600 5 жыл бұрын
Very good
@smailkhal
@smailkhal 3 жыл бұрын
Hello, i hope you reply to me. Can we write this program without using *if*? and how to replace *n=length(x)* with *size*
@mechtutorcom
@mechtutorcom 3 жыл бұрын
Hello. Thank you for the comment. Instead of if-statement, you may use a while-loop. But, you will still need a counter for j values. I believe using if-statement, as shown in the video, is much simpler. The size() function is more general than length() because it works with 2, 3 and higher dimensional arrays. In this program, both size() and length() work similarly. The difference is the array return value in size(). For example, [m] = size(x); n = m - 1; I hope I could answer your question.
@gricelbarrera6472
@gricelbarrera6472 Жыл бұрын
thanks!!
@user-ik5xm8ci7i
@user-ik5xm8ci7i 3 жыл бұрын
Please, if you are reading this, tell me - why is the " pr " (product variable) equal to one and not any other number?!
@vesto6864
@vesto6864 5 ай бұрын
Thanks
@sukranochani5764
@sukranochani5764 2 жыл бұрын
thanks 👍👍👍👍
@bingxinyan8103
@bingxinyan8103 2 жыл бұрын
Great
@mervedenizyldz4226
@mervedenizyldz4226 4 жыл бұрын
Thank you so much for this great explanation. Can you help me with how to obtain the exact polynomial of degree n fitting the data points we have? What should I add to the code you have written in the video? Thanks.
@mechtutorcom
@mechtutorcom 4 жыл бұрын
Thank you Merve for your comment. The degree of polynomial in Lagrange interpolation depends on the number of the given x,y points. If you need to change the degree, you have to increase or decrease the points.
@mervedenizyldz4226
@mervedenizyldz4226 4 жыл бұрын
@@mechtutorcom Thank you so much , I am going to try it.
@MuhammadBilal-bu3wc
@MuhammadBilal-bu3wc 3 жыл бұрын
I have repeated the same code as that of you but my answer doesn't matches. So could you please help me out?
@mechtutorcom
@mechtutorcom 3 жыл бұрын
The code in the video was run on Octave. If you're using MATLAB, some small changes might be needed to have matching results. You can copy and paste your code here, and I will certainly check it.
@stonedcodingtom9097
@stonedcodingtom9097 2 жыл бұрын
thx
@equiknox_
@equiknox_ Ай бұрын
Why is sm = 0??
@alexanderotalvaro6819
@alexanderotalvaro6819 3 жыл бұрын
mister , por que no me arroja resultado , espero su respuesta pa ya , gracias por la atención prestada
@mechtutorcom
@mechtutorcom 3 жыл бұрын
Without seeing your code, it is difficult to know why it does not give results. Is there an error message?
@rabid6767
@rabid6767 4 жыл бұрын
jys n bees
@anujitmaity0722
@anujitmaity0722 2 жыл бұрын
Poor voice
Bisection Method | Programming Numerical Methods in MATLAB
9:56
mechtutor com
Рет қаралды 144 М.
Cat Corn?! 🙀 #cat #cute #catlover
00:54
Stocat
Рет қаралды 15 МЛН
Дарю Самокат Скейтеру !
00:42
Vlad Samokatchik
Рет қаралды 7 МЛН
NERF WAR HEAVY: Drone Battle!
00:30
MacDannyGun
Рет қаралды 58 МЛН
Lagrange Interpolating Polynomial in Matlab (Numerical Method)
11:21
Newton-Raphson Method with MATLAB code
28:20
ATTIQ IQBAL
Рет қаралды 112 М.
Useful functions for game designers - Lagrange Interpolation
18:01
The Art of Code
Рет қаралды 17 М.
Lagrange Interpolation
20:44
Dr Peyam
Рет қаралды 30 М.
Lagrange Interpolating Polynomial Function MATLAB
14:41
Tim Trammel
Рет қаралды 503
Lagrange Interpolation with MATLAB code
38:42
ATTIQ IQBAL
Рет қаралды 29 М.
Cat Corn?! 🙀 #cat #cute #catlover
00:54
Stocat
Рет қаралды 15 МЛН