Import Graph to Curvefitting

5 views (last 30 days)
ANANTA BIJOY BHADRA
ANANTA BIJOY BHADRA on 23 Feb 2022
Answered: Shivang on 29 Sep 2023
I have a B-H curve through simulink simulation. It is plotted through X-Y graph of the simulink. How can I import it to curvefiiting section to get some data?

Answers (1)

Shivang
Shivang on 29 Sep 2023
Hi Ananta,
I understand you're trying to take a X-Y graph plot in Simulink and then fit a curve to the plot's data.
This can be done by exporting the data captured by the X-Y graph block to a variable/file and then importing that data inside the Curve Fitter app.
The X-Y Graph block includes options to record data. If you double-click on the block, you should see the "Record to Workspace" and "Record to File" options in the Simulation tab.
You can extract the relevant signals from the Simulation Output object and save them to different variables for ease of use. For example, say you select the "Record to Workspace" option and specify the Variable Name as 'data'. You can save the x-axis data to a variable named ‘x’ by writing,
x = out.data{1}.Values.Data
Similarily, the y-axis data can be saved to a variable named ‘y’ by writing,
y = out.data{2}.Values.Data
You can now import these data variables inside the Curve Fitter app, by using the "Select Data" option. Refer to the documentation for more details: https://www.mathworks.com/help/curvefit/curve-fitting.html
Hope this helps.
-Shivang

Categories

Find more on Fit Postprocessing 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!