Is it possible to obtain polynomial function (equation) or curve fit function from saved (plotted) dataset array?

2 views (last 30 days)
Hello.
First of all, sorry if this question might sound simple and silly. This is my first attempt to involve this comunity. I'm new with Matlab, hence I appriciate a lot if someone able to guide me on this. Thank you.
As mentioned above, I have a set of data in array (voltage, time) from a simulink simulation. The data been log from a scope. I try to look into almost similar question of mine in this forum, however most of the answers provided are not for dataset array input. I try to use the suggested method with array type data and obviously its will be error. Here some on my code to give a brief idea on what I'm working on.
%% 1. For Volatge Measurement
n = 0;
MinRint = 0.00889;
figure('Name','Data Plot of Change of Internal Resistance over Voltage Measurement');
for n=1:30
filename = sprintf('dataCRLS_IntRes_%d.mat',n);
load(filename, 'data');
txt = [sprintf('%.5f Ohm',MinRint)];
plot(data(:,1), 'DisplayName',txt); % Here is my voltage data stored
title('Line Plot of Voltage and Discharge Time of Different Internal Resistance');
xlabel('Time (seconds)') ;
ylabel('Voltage (V)') ;
%% Here is my attempt to obtain the polynomial function.
p = polyfit(data(:,1));
hold on
MinRint = MinRint + IntResSamp;
end
  5 Comments
Syafiq Anwar
Syafiq Anwar on 30 Mar 2019
Edited: Syafiq Anwar on 30 Mar 2019
Here is the attachment per request Sir. Inside the file contains:
  • a - 3513x5 double type
  • crls - 1x1 dataset
  • data - 4501x5 double type
  • sample_IntRes - 30x1 double type
there is 5 column. The first one is voltage, current, power, SOC and temperature respectively.
Thank you.

Sign in to comment.

Answers (0)

Categories

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