Frequency Response Importer block in Simulink

2 ビュー (過去 30 日間)
Ganesh Prasad
Ganesh Prasad 2024 年 2 月 20 日
回答済み: Satwik 2024 年 9 月 18 日
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 件のコメント
Roman Katzer
Roman Katzer 2024 年 2 月 20 日
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 2024 年 2 月 20 日
Is there no option to directly import the mag/phase data into a block in SIMULINK?

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

回答 (1 件)

Satwik
Satwik 2024 年 9 月 18 日
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!

カテゴリ

Help Center および File ExchangeSingle-Rate Filters についてさらに検索

製品


リリース

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by