Why does it give error in spectrogram plotting?

조회 수: 1 (최근 30일)
Rahul
Rahul 2024년 4월 3일
댓글: Rahul 2024년 4월 3일
Hello,
I'm getting an error while generating spectrogram.
  1. It shows "Dot indexing is not supported for variables of this type."
  2. Why does readmatrix doesn't work?
My data is also attached herewith.
Can someone guide me please.
My code as below:
close all;
freq_sam = 100000; % samples in data
period_sam = 0.005; % time period
freq_sys = 1/period_sam; % frequency
data = @(filename)fullfile('D:\Rahul\Data_tokamak\data&plot\data_paper1\H-mode data\H-mode bistable model\set1_neoAno_ratio_10\beta0.01\data1_H0_27b.mat',filename);
%data = readmatrix('D:\Rahul\Data_tokamak\data&plot\data_paper1\H-mode data\H-mode bistable model\set1_neoAno_ratio_10\beta0.01\data1_H0_27b.mat');
x_data = data.variable.t(1,:);
y_data = data.variable.Gamma(1,:);
disp(x_data);
disp(y_data);
Ts = mean(diff(x_data));
Fs = 1/Ts;
disp(Fs);
figure
pspectrum(y_data, Fs, 'spectrogram') % Plot 'pspectrum' 'spectrogram'
[sp,fp,tp] = pspectrum(y_data,Fs,"spectrogram", 'TimeResolution',0.5,'OverlapPercent',0,'Leakage',0.85); % Return Values, Then Plot
%waterfall(fp,tp,sp')
%set(gca,XDir="reverse",View=[60 60])
xlabel("Time (s)")
ylabel("Frequency (Hz)")
%signal_tt1 = data1;
%fft_tt1 = fft(signal_tt1); % fourier transform
%fft_tt1 = fftshift(fft_tt1); % performing fft shift
%f = freq_sam/2*linspace(-1,1,freq_sam);
%figure;
%plot(f, fft_tt1);

채택된 답변

KSSV
KSSV 2024년 4월 3일
Replace
data = @(filename)fullfile('D:\Rahul\Data_tokamak\data&plot\data_paper1\H-mode data\H-mode bistable model\set1_neoAno_ratio_10\beta0.01\data1_H0_27b.mat',filename);
with
load(fullfile('D:\Rahul\Data_tokamak\data&plot\data_paper1\H-mode data\H-mode bistable model\set1_neoAno_ratio_10\beta0.01\data1_H0_27b.mat'));

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Time-Frequency Analysis에 대해 자세히 알아보기

태그

제품


릴리스

R2023a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by