How to convert this Matlab script in Igor
jessy1157
I am relative a new Igor user and I am trying to make a Igor program that can do the following:
%% Given Data
k=0.39761; %Equivalent k
%% Approach Curves Data Sets
DATA2=load('C:\...\defl_ext.txt'); %collected Deflection from a dynamic approach curve[m]
DATA3=load('C:\...LVDT_ext.txt'); %Z Piezo Position [m]
% Filter
DATA2 = smooth(DATA2,15);
Fts0=zeros(n,1);
dgap=zeros(n,1);
Fts0new=zeros(n,1);
Zp=DATA3;
for i=1:n;
Fts0(i,1)=k.*DATA2(i,1);
end
%%Convert F-Z to F-d (nN vs. nm)
for i=1:n;
dgap(i,1)=-Zp(i,1).*10^9-DATA2(i,1); %nm
Fts0new(i,1)=Fts0(i,1).*10^9; %nN
end
%Find minimum force value (app), shift tip-sample distance
Fts0min = min(Fts0);
gapp = dgap;
ind=find(Fts0min);
gapp_min=dgap(ind,1);
for i=1:n
dgap(i,1)=-(dgap(i,1)-gapp_min);
end
plot(dgap,Fts0new,'-b')
It will be really appreciated if someone can give me some ideas of how to convert this to Igor.
Thanks:
Alexander Cartagena
But as a non-Matlab person, I am left wondering:
What is n and where did it come from?
What is that ... stuff in the file path?
What does the .* syntax mean?
August 5, 2010 at 07:49 am - Permalink
variable k=0.39761 // Equivalent k
// Approach Curves Data Sets
newpath /o myData "C:someFolder:someSubFolder"
loadwaves /j/n=DATA2/p=myData "defl_ext.txt" //collected Deflection from a dynamic approach curve[m]
loadwaves /j/n=DATA3/p=myData ".LVDT_ext.txt" // %Z Piezo Position [m]
wave DATA2,DATA3
// Filter
smooth 15,DATA2
make /o/n=(n) Fts0=0,dgap=0,Fts0new=0
duplicate /o DATA3,Zp
Fts0=k*DATA2
// Convert F-Z to F-d (nN vs. nm)
dgap=-Zp*10^9-DATA2 // %nm
Fts0new=Fts0*10^9 // %nN
// Find minimum force value (app), shift tip-sample distance
wavestats /q Fts0
duplicate /o gapp,dgap
variable gapp_min=dgap(v_minloc,1)
dgap=gapp_min-dgap
display Fts0new vs dgap
August 5, 2010 at 04:59 pm - Permalink
http://www.igorexchange.com/project/matlab
The only release is here:
http://www.igorexchange.com/node/1687
August 5, 2010 at 05:03 pm - Permalink