Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 1

function pushbutton1_Callback(hObject, eventdata, handles)

x=str2num(get(handles.edit1,'string'));
y=str2num(get(handles.edit2,'string'));
a=str2num(get(handles.edit3,'string'));
w=length(x);
L=zeros(w,w);
for k=1:w
V=1;
for j=1:w
if k~=j
V=conv(V,poly(x(j)))./(x(k)-x(j));
end
end
L(k,:)=V;
end
C=y*L;
Pa=polyval(C,a);
L='Coeficientes';
L=strvcat(L,num2str(C));
set(handles.listbox1,'string',L);
set(handles.edit4,'string',Pa);
%Grafica
y1=polyval(C,x);
plot(x,y1,'squarer','MarkerFaceColor','m','MarkerSize',8);
hold on
x1=x(1):0.1:x(w);
y=polyval(C,x1);
plot(x1,y)
grid on
hold off

PROGRAMACION

function pushbutton2_Callback(hObject, eventdata, handles)


set(handles.edit1,'string',' ');
set(handles.edit2,'string',' ');
set(handles.edit3,'string',' ');
set(handles.edit4,'string',' ');
set(handles.listbox1,'string',' ');
plot(0,0)

function pushbutton3_Callback(hObject, eventdata, handles)


close

You might also like