Effacer les filtres
Effacer les filtres

measuring local slope from scatter plot data and replotting this value

5 vues (au cours des 30 derniers jours)
Em le 18 Fév 2022
I want to make a plot of
Ln[dLn(c)/dLn(x)] vs Ln(x)
where I have measured c at different irregularly spaced x and the c value varies quite a lot so that the differential should change quite a lot from point to point and some fitting between a few points is probably a better way to represent the differential at any value. I suppose a window between +-3 points or so is probably a better way to represent the gradient. Does anyone have any idea how to plot this data?
Just to add to this - I've tried to use the graph fitting app but it's not working and im not sure why. I've tried plotting Ln(c) vs Ln(x) then fitting exp^W(x) to a plot of Ln(c) vs Ln(x)

Réponses (1)

Pavan Sahith
Pavan Sahith le 19 Oct 2023
I understand you have some irregularly spaced data, and you are trying for some fitting within a ±3 points, a 7-element window to represent the gradient in a better way.
As a workaround you can try using “smoothdata function.
Please refer to the following example code which uses “smoothdata” with some sample data and sample method.
x = 1:100;
A = cos(2*pi*0.05*x+2*pi*rand) + 0.5*randn(1,100);
% using movmean method in a window of 7 elements
C = smoothdata(A,"movmean",7);
Please refer to this MathWorks documentation links to know more about




Community Treasure Hunt

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

Start Hunting!

Translated by