0% found this document useful (0 votes)
5 views

'String' 'String' 'String': Function

This document contains the code for three callback functions used to control buttons on a GUI. The first function performs polynomial interpolation on input data to calculate coefficients and evaluate the polynomial at a given point. The coefficients are displayed and a plot is generated. The second function clears all input and output fields and resets the plot. The third function closes the GUI.

Uploaded by

Javier Fc
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

'String' 'String' 'String': Function

This document contains the code for three callback functions used to control buttons on a GUI. The first function performs polynomial interpolation on input data to calculate coefficients and evaluate the polynomial at a given point. The coefficients are displayed and a plot is generated. The second function clears all input and output fields and resets the plot. The third function closes the GUI.

Uploaded by

Javier Fc
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 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