below is matlab code which working properly in matlab to genrate FFT and plotting graph. but i am stuck in Simulink to create the model of below matlab code.
% Load data (simple numeric CSV).
data = readmatrix('C:\Users\v\Documents\MATLAB\testing\cable test\04042025\smallsensor.csv');
% Time domain
%num_samples = length(data);
time_max = 1.6; % Or your actual time duration
time = linspace(0, time_max, 4095)
figure;
plot(time, data);
xlabel('Time (s)');
ylabel('Amplitude');
title('Time Domain Signal');
xlim ([0 1.6]);
grid on;
% Frequency domain (FFT) - Accurate
Fs = num_samples / time_max; % Sampling frequency
yf = fft(data);
% Positive frequencies (handles even/odd num_samples correctly)
if mod(num_samples, 2) == 0
f = Fs*(0:num_samples/2)/num_samples;
yf_positive = yf(1:num_samples/2+1);
else
f = Fs*(0:(num_samples-1)/2)/num_samples;
yf_positive = yf(1:(num_samples+1)/2);
end
yf_magnitude = abs(yf_positive);
figure;
plot(f, yf_magnitude);
xlabel('Frequency (Hz)');
ylabel('Magnitude (mm/s^2)');
title('FDS-Ma-3000-1.4mm (FFT)');
xlim([0 250]); % Set x-axis limits from 0 to 100 Hz (example)
%ylim([0 2500]); % Set y-axis limits from 0 to 500 (example)
grid on;