Advertisement
franciscominajas

Untitled

Oct 30th, 2017
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. % las densidades de sodio para 3 temperaturas estan dadas como sigue:
  2. %t(°c)=94,205,371
  3. %p(kg/m^3)=929,902,860
  4. %determine el polinomio de iterpolacion de lagrange y aproxime los 3 datos
  5. %y con el estime la densidad a una temperatura de 251 °c
  6. clc;
  7. clear all;
  8. t=[94,205,371];
  9. d=[929,902,860];
  10.  
  11. plot(t,d,'o','MarkerSize',10,'MarkerFaceColor','r','MarkerEdgeColor','r')
  12. %calculo de los lagranjianos
  13. syms T
  14. l1=expand((T-t(2))*(T-t(3))/((t(1)-t(2))*(t(1)-t(3))));
  15. pretty(l1)
  16. l2=expand((T-t(1))*(T-t(3))/((t(2)-t(1))*(t(2)-t(3))));
  17. pretty(l2)
  18. l3=expand((T-t(1))*(T-t(2))/((t(3)-t(1))*(t(3)-t(2))));
  19. pretty(l2)
  20.  
  21. D=vpa(l1*d(1)+l2*d(2)+l3*d(3),8);
  22. hold on
  23. ezplot(D,[-90,500]);
  24. grid on
  25. temperatura=251;
  26. densidad=subs(D,temperatura)
  27.  
  28. plot(temperatura,densidad,'x','MarkerSize',10,'MarkerFaceColor','g','MarkerEdgeColor','g');
  29. %ciclo rapido
  30.  
  31. l=1;
  32. D1=0;
  33. for ii=2:length(t)
  34. for i=1:length(t)
  35. if i~=ii
  36. l=l*(T-t(i))/(t(ii)-t(i));
  37. end
  38. end
  39. D1=D1+expand(l)*d(ii);
  40. end
  41. format long
  42. D1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement