# How to get an equation from an already plotted graph in matlab

8 views (last 30 days)
kyungdoo lee on 26 Oct 2021
Commented: kyungdoo lee on 28 Oct 2021
clear all
clc
T = table2array(T) ;
x = T(1,2:end); % coil length
y = T(2:end,1); % magnitude length
Z = T(2:end,2:end); % use fillmissing to fill NaNs
[X,Y] = meshgrid(x,y) ;
[xq,yq] = meshgrid(2:0.1:10); % grid interval 0.1
Zq = interp2(x,y,Z,xq,yq,'spline'); % we use spline cubic, makima also available
figure
AA = surf(xq,yq,Zq);
title('(spline,cubic,makima) Interpolation Using Finer Grid');
I got the attached graph using the above code. (The 'data.xlsx' required when creating the code is also attached.)

Image Analyst on 26 Oct 2021
I don't think you can. You can probably get the numerical data out, but the equation -- I don't think so. For a simple example, visualize a sine wave. And you want the sine wave equation out - well what if you got a sine wave equation but the user actually plotted a cosine wave with a phase shift so that it looks, and is, identical yet has a completely different equation.
kyungdoo lee on 28 Oct 2021

### Community Treasure Hunt

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

Start Hunting!

Translated by