Frequency Response Importer block in Simulink

2 views (last 30 days)
Hello,
I have magnitude and phase response data of a system for different frequencies in an excel.I need to import this data into SIMULINK using the frequency response importer block and then pass a step input to the block.I am unable to find it in MATLAB R2023b version.Can someone help in locating the frequency response importer block or let me know how to import the magnitude and phase response data of a system in SIMULINK.
  2 Comments
Roman Katzer
Roman Katzer on 20 Feb 2024
You could try using an m file block. Create the code using Matlab's code generation when importing your data there. You may need to create a FIR or IIR filter from your magnitude/phase data to be able to feed it into a Simulink block.
Ganesh Prasad
Ganesh Prasad on 20 Feb 2024
Is there no option to directly import the mag/phase data into a block in SIMULINK?

Sign in to comment.

Answers (1)

Satwik
Satwik on 18 Sep 2024
Hi Ganesh,
Simulink does not offer a block specifically for importing phase and magnitude data directly from an excel file, but this can be achieved using a combination of Simulink blocks and MATLAB functionalities. Here is how:
1. Import Data into MATLAB: Use MATLAB to import data from excel. Utilize the ‘readtable’ function to bring frequency, magnitude, and phase data into MATLAB.
data = readtable('data.xlsx');
frequency = data.Frequency; % Replace with your actual column name
magnitude = data.Magnitude; % Replace with your actual column name
phase = data.Phase; % Replace with your actual column name
2. Convert to Complex Frequency Response: Convert the magnitude and phase data into a complex frequency response.
H = magnitude .* exp(1i * deg2rad(phase));
3. Create a Transfer Function or FRD Object: Use the imported data to create a frequency response data (FRD) object.
sys = frd(H, frequency);
For more information on the ‘frd’ function you may refer to the documentation given below:
4. Simulink Model Setup: Open Simulink and create a new model. Use the ‘From Workspace’ block to import the ‘sys’ object into Simulink. Set the ‘Data’ parameter of the ‘From Workspace’ block to ‘sys’.
Hope this helps!

Products


Release

R2023b

Community Treasure Hunt

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

Start Hunting!