# How to perform calc. on the selected part of curve and then reassemble it with rest part of curve in MATLAB?

3 ビュー (過去 30 日間)
Nisar Ahmed 2021 年 12 月 8 日
コメント済み: Mathieu NOE 2022 年 1 月 5 日
Hello everyone,
I would be thankful if someone can help me to guide me here. Here is the attached plot between VP and Depth. I want to perform some calculations only on the encircled part of VP curve (i.e from Depth 1917 - 1976 meter) and want to plot (new) full curve after calculations in such a way that the the encircled part is changed but rest of curve is same (above and below).
Plz help me to solve this issue. If I select encircled part and perform some calculations then how can I reassembled the circled part with above and below portions.
Thanks

サインインしてコメントする。

### 採用された回答

Mathieu NOE 2021 年 12 月 8 日
hello
see my little demo below
I extracted the portion of data of interest - you can do computation or smoothing and put back the smoothed portion in lieu of the original data
my plot is horizontal but that does not impact the demo principle
code
% dummy data
depth = (1870:2200);
VP = 1+rand(size(depth));
VP(1917-1870:1976-1870) = VP(1917-1870:1976-1870) + 2; % create a local step
%% main code
ind = find(depth>=1917 & depth<=1976);
VP_extract = VP(ind);
% math
VP_extract_mean = mean(VP_extract);
% smooth
VP_extract_smooth = smoothdata(VP_extract,'gaussian',20);
% replace original VP_extract with VP_extract_smooth
newVP = VP;
newVP(ind) = VP_extract_smooth;
plot(depth,VP,depth,newVP);
##### 8 件のコメント表示非表示 7 件の古いコメント
Mathieu NOE 2022 年 1 月 5 日
as usual, my pleasure !

サインインしてコメントする。

### Community Treasure Hunt

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

Start Hunting!

Translated by