Lagrange Interpolation Question!
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Reid Mcleod
el 7 de Oct. de 2021
Respondida: Shravan Kumar Vankaramoni
el 11 de Oct. de 2021
Below is a homework question for my Numerical Analysis course! I am not asking for someone to solve/write it! I wrote my own code based off what we learned in class, and it continued to not work. The code seen below is the teachers code from office hours but he didn't have time to explain it and I was hoping someone here may help!
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/761086/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/761091/image.png)
My code was practically the same but I was using L = ones(length(x),N) and I did not have the L(:,1) = ones(1,length(x)); and I am confused what difference that made?
Any explanation helps! They kind of threw us into Matlab full speed and I am trying to catch up!
0 comentarios
Respuestas (1)
Shravan Kumar Vankaramoni
el 11 de Oct. de 2021
Hi,
"ones(a,b)" returns a-by-b array of ones.
L = ones(length(x),N); %length(x)-by-N array
L(:,1) = ones(1,length(x)); %length(x)-by-1
In the above cases, size of the array returned is different. So, you are replacing with an array of different size that might have changed your result. For more information refer the below doc:
0 comentarios
Ver también
Categorías
Más información sobre Matrix Indexing en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!