for up-chirp generation
fs = 1000; % Sampling frequency (Hz)
t = 0:1/fs:1; % Time vector (1 second duration)
f_start = 50; % Starting frequency (Hz)
f_end = 200; % Ending frequency (Hz)
% Generate up-chirp signal
up_chirp = chirp(t, f_start, 1, f_end, 'linear');
t = 0:1/fs:1; % Time vector (1 second duration)
f_start = 50; % Starting frequency (Hz)
f_end = 200; % Ending frequency (Hz)
% Generate up-chirp signal
up_chirp = chirp(t, f_start, 1, f_end, 'linear');
plot(up_chirp)
for down-chirp generation
fs = 1000; % Sampling frequency (Hz)
t = 0:1/fs:1; % Time vector (1 second duration)
f_start = 200; % Starting frequency (Hz)
f_end = 50; % Ending frequency (Hz)
% Generate up-chirp signal
t = 0:1/fs:1; % Time vector (1 second duration)
f_start = 200; % Starting frequency (Hz)
f_end = 50; % Ending frequency (Hz)
% Generate up-chirp signal
down_chirp = chirp(t, f_start, 1, f_end, 'linear');
plot(down_chirp)
for decoding of the up-chirp signal
clc;
clear all;
close all;
fs = 1000; % Sampling frequency (Hz)
t = 0:1/fs:1; % Time vector (1 second duration)
f_start = 50; % Starting frequency (Hz)
f_end = 200; % Ending frequency (Hz)
% Generate up-chirp signal
up_chirp = chirp(t, f_start, 1, f_end, 'linear');
% Perform Short-Time Fourier Transform (STFT)
window_size = 64;
hop_size = 32;
[spectrogram, frequencies, time] = spectrogram(up_chirp, window_size, hop_size, [], fs);
% Extract instantaneous frequency
instantaneous_frequency = fs/(2*pi) * angle(spectrogram(2,:));
figure(); imagesc(time, frequencies, 10*log10(abs(spectrogram)));
clear all;
close all;
fs = 1000; % Sampling frequency (Hz)
t = 0:1/fs:1; % Time vector (1 second duration)
f_start = 50; % Starting frequency (Hz)
f_end = 200; % Ending frequency (Hz)
% Generate up-chirp signal
up_chirp = chirp(t, f_start, 1, f_end, 'linear');
% Perform Short-Time Fourier Transform (STFT)
window_size = 64;
hop_size = 32;
[spectrogram, frequencies, time] = spectrogram(up_chirp, window_size, hop_size, [], fs);
% Extract instantaneous frequency
instantaneous_frequency = fs/(2*pi) * angle(spectrogram(2,:));
figure(); imagesc(time, frequencies, 10*log10(abs(spectrogram)));
for decoding of down-chirp signal
fs = 1000; % Sampling frequency (Hz)
t = 0:1/fs:1; % Time vector (1 second duration)
f_start = 200; % Starting frequency (Hz)
f_end = 50; % Ending frequency (Hz)
% Generate up-chirp signal
down_chirp = chirp(t, f_start, 1, f_end, 'linear');
% Perform Short-Time Fourier Transform (STFT)
window_size = 64;
hop_size = 32;
[spectrogram, frequencies, time] = spectrogram(down_chirp, window_size, hop_size, [], fs);
% Extract instantaneous frequency
instantaneous_frequency = fs/(2*pi) * angle(spectrogram(2,:));
figure(); imagesc(time, frequencies, 10*log10(abs(spectrogram)));
t = 0:1/fs:1; % Time vector (1 second duration)
f_start = 200; % Starting frequency (Hz)
f_end = 50; % Ending frequency (Hz)
% Generate up-chirp signal
down_chirp = chirp(t, f_start, 1, f_end, 'linear');
% Perform Short-Time Fourier Transform (STFT)
window_size = 64;
hop_size = 32;
[spectrogram, frequencies, time] = spectrogram(down_chirp, window_size, hop_size, [], fs);
% Extract instantaneous frequency
instantaneous_frequency = fs/(2*pi) * angle(spectrogram(2,:));
figure(); imagesc(time, frequencies, 10*log10(abs(spectrogram)));