% Initialize data
% written by Chris and Dan
% Displacement.m allows you to analyze the data you aquiered with the
% correlation, fitting or mean routine. It only needs the validx and
% validy and can calculate strain from it. Before you start you should
% consider cleaning up the data as described in the guide. After that step
% you can analyze parts of your data, or the full set. Try to use also the
% console command, e.g. if you want to analyze only image 100-110 since
% something really interesting happend there, load validx and validy into
% your workspace and call
% displacement(validx(:,100:110),validy(:,100:110));
% In this case displacement only loads the important images and you can
% clean this part of your data set.
% Changed 3. February 2008
function [validx,validy]=displacement(validx,validy)
%load data in case you did not load it into workspace yet
if exist('validx')==0
[validxname,Pathvalidx] = uigetfile('*.dat','Open validx.dat');
if validxname==0
disp('You did not select a file!')
return
end
cd(Pathvalidx);
validx=importdata(validxname,'\t');
end
if exist('validy')==0
[validyname,Pathvalidy] = uigetfile('*.dat','Open validy.dat');
if validyname==0
disp('You did not select a file!')
return
end
cd(Pathvalidy);
validy=importdata(validyname,'\t');
end
%define the size of the data set
sizevalidx=size(validx);
sizevalidy=size(validy);
looppoints=sizevalidx(1,1);
loopimages=sizevalidx(1,2);
%calculate the displacement relative to the first image in x and y
%direction
clear displx;
validxfirst=zeros(size(validx));
validxfirst=mean(validx(:,1),2)*ones(1,sizevalidx(1,2)); % 新建一个矩阵,每列都等于validx(:,1) %M = mean(A,dim) 返回A中沿着标量dim指定的维数上的元素的平均值。对于矩阵,mean(A,2)就是包含每一行的平均值的列向量。
displx=validx-validxfirst; % 得到X位移
save displx.dat displx -ascii -tabs
clear validxfirst
clear disply;
validyfirst=zeros(size(validy));
validyfirst=mean(validy(:,1),2)*ones(1,sizevalidy(1,2)); % 新建一个矩阵,每列都等于validy(:,1)
disply=validy-validyfirst; % 得到y位移
save disply.dat disply -ascii -tabs
clear validyfirst
%Prompt user for type of plotting / visualization
selection10 = menu(sprintf('How do you want to visualize your data?'),'3D Mesh Plot of Displacement'...
,'Full Strain Plots','Strain Measurement between 2 Points','1D Average Strain Measurement',...
'Rotate Orientation (exchange x and y)','Remove badly tracked marker, one by one (Position)',...
'Delete multible markers (Position)','Delete markers from displacement vs. position plot',...
'Delete points moving relative to their neighbours','Select Markers to Analyze ',...
'Save validx and validy','Average a couple of images','Cancel');
% Selection for Cancel - All windows will be closed and you jump back to
% the command line
if selection10==13
close all;
return
end
% This selection will average up a specified number of images to reduce the
% noise of the data set. I would like to point out that you will need to
% average your other sensor data (e.g. load data), too, to match it to your
% strain data.
if selection10==12
prompt = {'How many images would you like to combine as a base image? 对前多少张图片的网格压缩'};
dlg_title = 'Input number of images:';
num_lines= 1;
def = {'5'};
answer = inputdlg(prompt,dlg_title,num_lines,def);
if str2num(cell2mat(answer(1)))==0
disp('Get out, you changed your mind?')
[validx validy]=displacement(validx,validy);
return
else
baseimages = str2num(cell2mat(answer(1)));
if baseimages==[]
disp('Give me a number, will you?')
[validx validy]=displacement(validx,validy);
return
end
if baseimages>loopimages % 输入的数字过大, 超过分析的照片个数
disp('That is too large?!')
else
baseimagemean=mean(validx(:,1:baseimages),2); % 1:baseimages 列矩阵 沿行进行平均
validx(:,1:baseimages-1)=[]; % 把 validx 非baseimages 列设为空列
validx(:,1)=baseimagemean; % 形成新的图片网格
baseimagemean=mean(validy(:,1:baseimages),2);
validy(:,1:baseimages-1)=[];
validy(:,1)=baseimagemean;
end
end
[validx validy]=displacement(validx,validy);
return
end
% Save validx and validy, very useful if you cleaned up your dataset. Data
% will be saved as -ascii text file. If you send data like this by email
% you can reduce the size tremendously by compressing it. Use ZIP or RAR.
if selection10==11
[FileName,PathName] = uiputfile('validx_corr.dat','Save validx');
if FileName==0
disp('You did not save your file!')
[validx validy]=displacement(validx,validy);
return
else
cd(PathName)
save(FileName,'validx','-ascii')
[FileName,PathName] = uiputfile('validy_corr.dat','Save validy');
if FileName==0
disp('You did not save your file!')
[validx validy]=displacement(validx,validy);
else
cd(PathName)
save(FileName,'validy','-ascii')
end
[validx validy]=displacement(validx,validy);
return
end
end
% Select Points from detailed Analysis
if selection10==10
[validx validy validxbackup validybackup]=ppselection_func(validx,validy); % ppselection_func
if validx==0
validx=validxbackup;
validy=validybackup;
end
if validy==0
validx=validxbackup;
validy=validybackup;
end
[validx validy]=displacement(validx,validy);
end
% Remove markers moving relativ to their neighbours
if selection10==9
[validx,validy,displx,disply]=delete_jumpers(validx,validy,displx,disply); %delete_jumpers
[validx validy]=displacement(validx,validy);
end
% Remove markers from the displacement vs. position plot
if selection10==8
[validx,validy,displx,disply]=removepoints_func(validx,validy,displx,disply); %removepoints_func
[validx validy]=displacement(validx,validy);
end
% Remove bad points
if selection10==7
[validx,validy]=removepoints_func2(validx,validy); % removepoints_func2
[validx validy]=displacement(validx,validy);
end
% Remove bad points
if selection10==6
[validx validy]=removepoints_func3(validx,validy); % removepoints_func3
[validx validy]=displacement(validx,validy);
end
% Rotate Matrix
if selection10==5
[validx, validy]=rotatematrix(validx,validy); % rotatematrix
[validx validy]=displacement(validx,validy);
end
% 1D Strain plot using average strains for ELASTIC STRAIN only
if selection10==4
[validx validy]=strain_1D_average_func(validx, validy,displx,disply); %strain_1D_average_func
[validx validy]=displacement(validx,validy);
end
% 1D Strain plot
if selection10==3
[validx, validy,displx,disply]=strain_1D_2Points_func(validx, validy,displx,disply); % strain_1D_2Points_func
[validx validy]=displacement(validx,validy);
end
% Fast plotting, cropping needed for polynomial fit
if selection10==2
[validx, validy,displx,disply]=polyfit3D(validx, validy,displx,disply); % polyfit3D
[validx validy]=displacement(validx,validy);
end
% 3D Mesh Plotting
if selection10==1
if sizevalidx(1,1)>2
[validx, validy,~,disply]=meshplot(validx,validy,displx,disply); % meshplot
else
disp('You need at least three markers to display the 3D-plot')
msgbox('You need at least three markers to display the 3D-plot','3D-Plot','warn');
end
[validx validy]=displacement(validx,validy);
end
%---------------------------------
function [validx,validy,displx,disply]=delet
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
DICM.rar (33个子文件)
DICM 程序
ppselection_func.m 27KB
validxy_mean.m 2KB
grid_generator.m 25KB
DICMmen.m 4KB
multipeak_tracking.m 10KB
automate_image_rf.m 7KB
gauss_twopk.m 146B
surfit.m 916B
stress_strainmatch.m 2KB
findpeak.m 3KB
resume_automate_image.m 1KB
large_displ.m 2KB
polyfic.m 1KB
linearfit.m 61B
jobskript_mp.m 1KB
automate_image_mp_2009b.m 9KB
local_strainx.m 7KB
DICM.m 2KB
automate_image_ld.m 7KB
jobskript.m 1KB
peak_labelling.m 17KB
displacement.m 57KB
cpcorr.m 11KB
sortvalidpoints.m 2KB
filelist_generator.m 7KB
gauss_onepk.m 100B
Markerplotting.m 1KB
polyvac.m 632B
RTCorrCode.m 9KB
strain_lineprofile_marker.m 4KB
automate_image.m 9KB
line_visual.m 5KB
pickpeak.m 15KB
共 33 条
- 1
资源评论
刘良运
- 粉丝: 70
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功