专题软件开发实践报告

更新时间:2023-07-27 09:38:01 阅读量: 实用文档 文档下载

说明:文章内容仅供预览,部分内容可能不全。下载后的文档,内容与下面显示的完全一致。下载之前请确认下面内容是否您想要的,是否完整无缺。

教学实践报告

“反问题”的数值求解

学生姓名

专 业 信息与计算科学

班 级 1123202

指导教师

2014年9月5日

第一周实践报告

一、 任务安排

1.1 时间计划

本次实践共三周,又第二周上课时间只有两天,所以总共开发时间12天。经讨论小组将第一周开发最初的界面,第二周整合各组员的界面,第三周修改代码、程序调试、优化界面。

1.2 任务分工计划

小组成员,界面开发程序Filter_fn、Gen_data等六个,每人负责两个程序的界面开发,实现组员之间分工清晰、相互合作。

二、 熟悉“反问题”的数值解法研究

2.1 文献资料的翻译

通过指导老师及谷歌翻译得到资料的大致翻译,对研究问题有一个比较清晰的理解。

2.2 “反问题”数值解法

三、第一周所做:

3.1 反问题的理解及翻译

3.2 设置整体的界面及控件callback

3.3 把图形画到指定的区域

3.4 设置变量调用函数

四、程序理解:

function varargout = d(varargin)

% --- Executes on button press in pushbutton1.

function pushbutton1_Callback(hObject, eventdata, handles)%设置的控件反应

% hObject handle to pushbutton1 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) fg;%调用函数

% --- Executes on button press in pushbutton2.

function pushbutton2_Callback(hObject, eventdata, handles)

% hObject handle to pushbutton2 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) jiemian;

% --- Executes on button press in pushbutton3.

function pushbutton3_Callback(hObject, eventdata, handles)

% hObject handle to pushbutton3 (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'))%从文本框中获得数据赋值给s1 s2=str2double(get(handles.edit3,'String'))%从文本框中获得数据赋值给s2

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);

% --- Executes on button press in pushbutton5.

function pushbutton5_Callback(hObject, eventdata, handles)

% hObject handle to pushbutton5 (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;

% 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.

% Compute an eigendecomposition of K. K is symmetric, so this is % equivalent to an SVD.

[V,svals] = eig(K);

[svals,indx] = sort(-diag(svals)); % Sort -eigenvalues in decreasing order.

svals = -svals; % +eigs are in increasing order. V = V(:,indx); % Corresponding eigenvectors.

%figure(3)

semilogy(svals,'o')

xlabel('index i')

ylabel('\sigma_i')

title('Singular Values of K')

axes(handles.axes1);

本文来源:https://www.bwwdw.com/article/twmm.html

Top