Frequency Response Importer block in Simulink
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Roman Katzer
el 20 de Feb. de 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.
Respuestas (1)
Satwik
el 18 de Sept. de 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!
0 comentarios
Ver también
Categorías
Más información sobre Single-Rate Filters en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!