Plot the time-domain response of a swept frequency signal

15 ビュー (過去 30 日間)
Rohan Gulur
Rohan Gulur 2023 年 8 月 13 日
コメント済み: Rohan Gulur 2023 年 8 月 24 日
Hello, I am currently trying to plot the response of a swept-frequncy cosinusoidal signal and lsim this swept-frequency signal using a transfer function.
Ie; suppose I generate the following input swept frequency signal of the form:
y = chirp(t,f0,t1,f1)
And if i generate a continuous time transfer function of the format:
sys = tf(numerator,denominator)
Can i use lsim and plot the output of all signals within the swept-band?
output=lsim(sys,y,t)
The end goal of mine is to have all of these overlayed signals' eye diagrams be plotted.
I want to then do:
eyediagram(output, %numsamples/trace);
Is this good framework to follow or do you all suggest something else that may work better?
Regards

採用された回答

Paras Gupta
Paras Gupta 2023 年 8 月 21 日
Hi Rohan,
I understand that you want to plot time-domain response of multiple signals using eye diagrams in a swept frequency band. The approach followed by you is valid and can be run for multiple signals by:
  • Using for loops
  • Passing a signals matrix as input to the ‘lsim’ function
An example code that uses for loops is given below:
% Define the swept-band parameters
t = 0:0.01:10; % Time vector
f0 = 1; % Initial frequency
t1 = 10; % End time
f1 = 10; % Final frequency
numFreqs = 10; % Number of frequencies in the swept-band
% Generate the swept-band signals
frequencies = linspace(f0, f1, numFreqs); % Frequency range
signals = zeros(length(t), numFreqs); % Matrix to store the signals
for i = 1:numFreqs
signals(:, i) = chirp(t, f0, t1, frequencies(i));
end
% Define the transfer functions for each input channel
numerator = 1; % Numerator coefficients
denominator = [1, 1, 1]; % Denominator coefficients
sys = tf(numerator, denominator); % Define the transfer function for the current signal
% Simulate the response for each signal in the swept-band
outputs = zeros(length(t), numFreqs); % Matrix to store the outputs
for i = 1:numFreqs
outputs(:, i) = lsim(sys, signals(:, i), t);
end
% Plot the output of all signals within the swept-band
figure;
hold on;
for i = 1:numFreqs
plot(t, outputs(:, i));
end
hold off;
xlabel('Time');
ylabel('Output Signal');
title('Response of the System for Swept-Band Signals');
% Generate the eye diagram for a specific signal
signalIndex = 3; % Index of the signal to generate the eye diagram
numsamples = 100; % Number of samples per trace
eyediagram(outputs(:, signalIndex), numsamples);
xlabel('Time');
ylabel('Amplitude');
title('Eye Diagram of a Swept-Band Signal');
More information on using the signals matrix as an argument to the ‘lsim’ function can be found in the documentation below under section 'Plot Simulated Response of MIMO System'.
Hope this helps.
  1 件のコメント
Rohan Gulur
Rohan Gulur 2023 年 8 月 24 日
This is aweome Paras,
Eye Diagram looks really clean in this.
Thank you.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSignal Attributes and Indexing についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by