measuring local slope from scatter plot data and replotting this value
3 次查看(过去 30 天)
显示 更早的评论
Hi,
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?
Thanks!
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)
0 个评论
回答(1 个)
Pavan Sahith
2023-10-19
Hello,
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);
plot(x,C)
Please refer to this MathWorks documentation links to know more about
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Descriptive Statistics 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!