s3=str2double(get(handles.edit4,'String'))%从文本框中获得数据赋值给s3 h = 1/s1;
x = [h/2:h:1-h/2]';
% Compute matrix K corresponding to convolution with Gaussian kernel.
kernel = (1/sqrt(pi)/s2) * exp(-(x-h/2).^2/s2^2);
K = toeplitz(kernel)*h;
% Set up true solution f_true and data d = K*f_true + error.
f_true = .75*(.1<x&x<.25) + .25*(.3<x&x<.32) + (.5<x&x<1).*sin(2*pi*x).^4;
Kf = K*f_true;
eta = s3/100 * norm(Kf) * randn(s1,1)/sqrt(s1);
d = Kf + eta;
% Display the data.
% figure(2)
plot(x,f_true,'-', x,d,'o',x,Kf,'--')
xlabel('x axis')
axes(handles.axes1);%把图形画到指定的位置
% --- Executes on button press in pushbutton4.
function pushbutton4_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton4 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) s1=str2double(get(handles.edit2,'String'))
s2=str2double(get(handles.edit3,'String'))
s3=str2double(get(handles.edit4,'String'))
% Set up grid.
h = 1/s1;
x = [h/2:h:1-h/2]';
% Compute matrix K corresponding to convolution with Gaussian kernel. kernel = (1/sqrt(pi)/s2) * exp(-(x-h/2).^2/s2^2);
K = toeplitz(kernel)*h;
% figure(1)
mesh(K)
title('Mesh Plot Representation of Matrix K')
axes(handles.axes3);