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 CenterFile Exchange에서 Single-Rate Filters에 대해 자세히 알아보기

제품


릴리스

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by