Dear all,
I am not really an expert at Matlab and needed help in the following function and will really appreciate it.
I have written a function to identify and plot the data belonging to a unique combination of first column= temperature and second clumn= strain rate (Total 16 combinations, please see attached file)…….I am using 'unique' command to identify each value in the first column. However, i am not getting the desired plot of 16 curves. I think same temperature values in first column is problematic. Therefore, it is not able to identify it properly. The function is below:
kf1 = GetKf('AA7075');
[nT, nE] = size(kf1);
% plot all flow curves
figure; hold on;
for i=1:nT
for j=1:nE
if i==1
plot(kf0(i,j).e, kf0(i,j).s, 'r-');
elseif i==2
plot(kf0(i,j).e, kf0(i,j).s, '-');
else
plot(kf0(i,j).e, kf0(i,j).s, 'k-');
end
txt1=[num2str(kf0(i,j).T) ' C, ' num2str(kf0(i,j).e_dot) ' /s'];
text(kf0(i,j).e(end)+0.1, kf0(i,j).s(end), txt1);
end
end
function kf = GetKf(fname)
cname = ['load' fname '.txt;'];
eval(cname);
cname = ['kf_all=' fname ';'];
eval(cname);
Ts = unique(kf_all(:,1));
for i=1:length(Ts)
Tindx = find(kf_all(:,1)==Ts(i));
kf_T = kf_all(Tindx,2:4);
e_dots = unique(kf_T(:,1));
for j = 1:length(e_dots)
Eindx = find(kf_T(:,1)==e_dots(j));
kf(i,j).T=Ts(i);
kf(i,j).e_dot=e_dots(j);
kf(i,j).e = kf_T(Eindx,2);
kf(i,j).s = kf_T(Eindx,3);
end;
end;
Best Answer