Semilog plot in curve fitting tool

69 views (last 30 days)
I am new to using the curve fitting tool. I have some data that I want to fit a curve to. I have clicked on the curve fitting icon in Matlab and the form titled "Curve Fitting Tool" pops up. I've selected the vector containing the x data and the vector containing the y data. I then entered my custom equation and results are put into the "Results" box. Adjacent to the "Results" box is the graph. What I would like to be able to do is to have the graph show as a semilog plot (x values on log scale, y values on linear scale). I can't figure out how to do that.
Note that I am not ready to implement this into my MatLab code. I want to play around with equations first.

Accepted Answer

Pavan Guntha
Pavan Guntha on 16 Nov 2021
Hello Robert,
There isn't any direct option to plot the data in a semilog plot using Curve Fitting Toolbox. The workaround is as follows:
From the curve fitting tool, once you're done with the fitting, click on File -> Generate Code to generate the MATLAB code for your fit. Then you could vary the axes properties such that 'x' values get plotted on a log scale. The following example illustrates this process:
Consider the 'x' and 'y' data as:
xData = linspace(1,10000,20);
yData = [1:20];
You can click on Generate Code as shown below:
In the generated, after the plot command, you could place the following command to change the x-axis to log scale:
Hope this helps!

More Answers (0)

Community Treasure Hunt

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

Start Hunting!