How can I use cubic spline to smooth data and sketch graphs.

2 次查看(过去 30 天)
Hi.
I have large sets of data where I need to use cubic spline to apply smoothing and sketch the graph. In my data I need to find the average of total vertical electron content (VTEC) and come up with one hourly value using cubic spline and than sketch the against time for a period of 24hrs for every month. I'm new to matlab software and any help and suggestions is highly appriciated. Please find attached the set of sample data that i need to analyse for month of Feb. Thank you.
  2 个评论
John D'Errico
John D'Errico 2021-11-8
编辑:John D'Errico 2021-11-8
You don't use a cubic spline to average data at a given point. You really want to do that BEFORE you use a cubic spline.
Next, a cubic spline is typically an INTERPOLATING spline, so it won't smooth your data. It will pass directly through the data points.
Finally, you did NOT attach any data. You attached a small PICTURE of your data, which is completely useless unless someone were to try to type in your complete data set. I hope they have very good eyesight if they do. Is there a good reason why you want to make it more difficult for someone to help you?
If you really want help, then it would be best if you actually attach the true data. Do so either by pasting in the data as text, or by attaching a .mat file. A spreadsheet is also acceptable, but it takes slightly more effort for someone to read it in, IF they were going to try to help you. Again, is there a good reason why you want to make it difficult to get timely help? Please edit your question, or attach your data to a comment on your question. (Do not answer your question with the data, as many seem to do.)
Vikash Raj
Vikash Raj 2021-11-8
Appologies for any inconvenience. I have attached the spreadsheet file. Please suggest any suitable method to analyse this data set. Thank you.

请先登录,再进行评论。

采纳的回答

Mathieu NOE
Mathieu NOE 2021-11-9
hello
example of smoothing done on L1 data - FYI -
clc
clearvars
T = readtable('Feb 2020_Elv 50+.csv');
[samples,col] = size(T);
x = (0:samples-1);
L1 = T.L1;
L1s = smoothdata(L1,'movmedian',17);
plot(x,L1,x,L1s)
legend('raw','smoothdata')
  12 个评论
Mathieu NOE
Mathieu NOE 2021-11-12
If you have the Curve fitting toolbox the csaps function (and others) are available

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Splines 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by