How can I plot a function i can´t define before calculating it?
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Jose Ramirez
il 19 Ott 2020
Commentato: Jose Ramirez
il 19 Ott 2020
X = [1,2,4,5, 17, 34];
Y = [8,14,25,1,-3,27];
syms x;
sum = 0;
for i = 1: length(X)
u = 1;
l = 1;
for j = 1: length(X)
if j ~= i
u = u * (x - X(j));
l = l * (X(i)-X(j));
end
end
sum = sum + ((u/l)*Y(i));
end
disp(simplify(sum));
fplot(sum(x));
I´m trying to use Lagrange´s method for finding a polynomial, but after finding it i can´t plot the function "sum".
Is there a way to do that?
0 Commenti
Risposta accettata
Più risposte (0)
Vedere anche
Categorie
Scopri di più su 2-D and 3-D Plots in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!