measuring local slope from scatter plot data and replotting this value

조회 수: 2 (최근 30일)
Em
Em 2022년 2월 18일
답변: Pavan Sahith 2023년 10월 19일
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)

답변 (1개)

Pavan Sahith
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

카테고리

Help CenterFile Exchange에서 Descriptive Statistics에 대해 자세히 알아보기

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by