How can I approximate a data set from excel and plot over the original set?

2 visualizaciones (últimos 30 días)
Hello all,
-I have a data set in excel of 4 columns, 1st of these is Time. -I would like to reduce/down-sample this set to approximate the curve that it produces by a factor N (other than the time column) -Then I would like plot the original set and the reduced set overlaid, with each of the 3 non-time columns individually, plotted against the time data
I am able to accept the data into Matlab and plot.
I have looked at down-sample,dsplot and a few others but I'm quite unsure which is best for my application
I would very much appreciate being pointed in the right direction.
Best Regards Gavin

Respuesta aceptada

Kirby Fears
Kirby Fears el 16 de Oct. de 2015
Editada: Kirby Fears el 16 de Oct. de 2015
Hi Gavin,
If you're looking to plot every N-th point (reducing the total sample by a factor of N), you can do this very easily with indexing. Try adapting the example below to your needs.
myTime = (1:100)'; % Storing time separately
myData = [sin(myTime), cos(myTime), tan(myTime)]; % Fake data
n = 5; % Sample by taking every nth point
idxSamp = (1:n:size(myTime,1))';
% Plot original data and downsampled data
plot(repmat(myTime,1,size(myData,2)),myData,...
repmat(myTime(idxSamp),1,size(myData,2)),myData(idxSamp,:));
legend({'s','c','t','down s','down c','down t'});
Hope this helps.

Más respuestas (0)

Categorías

Más información sobre Line Plots en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by