Smooth curve in certain regions to get desired output
Afficher commentaires plus anciens
I have some data. I need to smooth it somehow. I am using smooth and medfilt1 but I cannot seem to get what I am expecting.
My data is attached. raw_data is the red curve you see in the image. The gray lines are t1, t2, and t3 respectively. I want to get the green curve, but I just cannot seem to find a solution. Any help is appreciated! Thanks ahead of time.

Réponse acceptée
Plus de réponses (1)
You may also try using curve fitting, here's the result I got:

(I did not adjust the scale of x-axis)
Here's the code, if you want to run this script, download the n-d curve & surface fitting pack,
detailed instructions can be found on this website.
clear; clc; close all;
load('data4question.mat');
data=1:numel(raw_data); label=raw_data';
Set up model.
NN.InputAutoScaling='on'; % perform normalization of data
NN.LabelAutoScaling='on';
InSize=1; OutSize=1;
LayerStruct=[InSize,3,5,5,OutSize];
NN=Initialization(LayerStruct,NN);
Set up optimizer.
option.Solver='ADAM';
option.MaxIteration=600; option.BatchSize=500;
NN=OptimizationSolver(data,label,NN,option);
Validating and visualize results.
P=NN.Evaluate(data);
figure;
plot(label)
hold on
plot(P,'LineWidth',1)
legend('raw data','curve fitting')
You may try different model structure or solver parameters to achieve the desired curve,
hope this might help you !
Catégories
En savoir plus sur Get Started with Signal Processing Toolbox dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

