Matlab error using imagesc()
이전 댓글 표시
I am trying to plot frequency-wavenumber from Das strain data. Error is found when I use imagesc to get the graph.
Error using image
Image XData and YData must be vectors.
Error in imagesc (line 52)
hh = image(varargin{:}, 'CDataMapping', 'scaled');
Error in a6 (line 52)
imagesc(k,f,abs(st));
The Matlab script is given below. Any help would be appreciated.
Dasdata_folder = 'C:\Users\dan24\Documents\MATLAB\Flow Loop Fiber Strain Readings\DAS Data\2.5 Lpm Step Test for 2 inch pipe with 0 insulation/';
testName = '2.5 Lpm';
file_start = [];
plot_title = '2.5 Lpm flow';
save_plot = true; %saves plots as png files if true
channels = 55:67; %define specific channels you want plots of
folder_path = [Dasdata_folder testName '/'];
figure_save_name = [testName '_' file_start];
Dasdata = ReadDasLogV4(folder_path, file_start);
Fs = 15625; %sampling frequency
i = 1:length(channels);
y = Dasdata.Strain(channels(i),:);
L = length(y); data=abs(y/L);
T=Dasdata.Time(channels);
dt=T(2:end)-T(1:end-1);
Nt=length(T);
X=Dasdata.Position(channels);
dx=X(2:end)-X(1:end-1);
Nx=length(X);
fn=1./2./dt;
kn=1./2./dx;
df=1./Nt./dt;
dk=1./Nx./dx;
f=[-fliplr(1:(Nt/2)) 0 (1:(Nt/2-1))].*df;
k=[-fliplr(1:(Nx/2)) 0 (1:(Nx/2-1))].*dk;
st=fftshift(fft2(data))./Nx./Nt;
figure(1);
%xticks = get(gca,'XTick')/Fs;
%for i = 1:length(xticks)
% xticklabels{i} = num2str(xticks(i),3);
%end
%set(gca,'XTickLabels',xticklabels);
imagesc(k,f,abs(st));
colorbar;
%title('FFT2');
%xlabel('k (1/m)')
%ylabel('f (Hz)')
%spec=st.*conj(st)./df./dk;
%figure(2)
%imagesc(f,k,log10(spec)); axis xy
%colormap(jet)
%shg
%xlabel('k (1/m)')
%ylabel('f (Hz)')
댓글 수: 1
Image Analyst
2021년 10월 15일
You forgot to attach any data or the ReadDasLogV4() function:
Unrecognized function or variable 'ReadDasLogV4'.
Error in test8 (line 16)
Dasdata = ReadDasLogV4(folder_path, file_start);
We'll check back later for it. In the meantime, check very carefully the three inputs your sending to imagesc() and validate that it can take those types of arguments.
채택된 답변
추가 답변 (1개)
Iffat Arisa
2021년 10월 15일
0 개 추천
댓글 수: 2
Image Analyst
2021년 10월 15일
I think you forgot to attach a .das file, didn't you?
Iffat Arisa
2021년 10월 16일
카테고리
도움말 센터 및 File Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!