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

57 views (last 30 days)
clear all
clc
T = readtable('data1.xlsx') ;
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.)
I am trying to get an equation (function) from an already plotted graph, please help me with the code

Accepted Answer

Image Analyst
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.

More Answers (0)

Categories

Find more on Interpolation in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!