How can i export datas on the bode plot in SIMULINK?
26 views (last 30 days)
Show older comments
DONGHWAN HWANG
on 13 Dec 2016
Commented: DONGHWAN HWANG
on 1 Jan 2017
Hello, I need to exprot data from bode plot block in SIMULINK
I made diagram block and run the SIMULINK file but I couldn't get the data based on frequency(x-axis) and magnitude(y-axis).
I only get 'structure' data... but it dosen't include data what i want
To get datas, I tried to make output port on the Bode plot(To Workspace block) and check 'Save data to workspace' on the logging of Bode plot option
How can i export the data from the bode plot in SIMULINK?
0 Comments
Accepted Answer
Arkadiy Turevskiy
on 14 Dec 2016
When you run the model with Bode Plot block, with "save data to workspace" enabled, you get a variable sys, or whatever name you specified for it. sys is a structure, like you said. It contain frequency response information in the form of state-spaces matrices A,B,C,D as well as block name and snapshot time when linearization was computed.
To access state space matrices type
sys.values
To get magnitude, phase and frequency data from the bode plot:
[mag,phase,w]=bode(sys.values);
Recreate Bode plot:
semilogx(squeeze(w),20*log10(squeeze(mag)))
subplot(211)
semilogx(squeeze(w),20*log10(squeeze(mag)))
subplot(212)
semilogx(squeeze(w),squeeze(phase))
More Answers (0)
See Also
Categories
Find more on Time and Frequency Domain Analysis in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!