Why does it give error in spectrogram plotting?
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Hello,
I'm getting an error while generating spectrogram.
- It shows "Dot indexing is not supported for variables of this type."
- 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);
0 Commenti
Risposta accettata
KSSV
il 3 Apr 2024
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'));
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Time-Frequency Analysis in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!