Extract values from image

1 回表示 (過去 30 日間)
René Dienemann
René Dienemann 2019 年 10 月 19 日
コメント済み: René Dienemann 2019 年 10 月 24 日
Hi,
I've got some data from a magnetic measurement on a surface.
I've plotted these data (see the attached pic). Is there a possibillity to get or extract values from this plot.
I need all values of the picture along the red line.
Many thanks for your help and best regards!!!

採用された回答

Fabio Freschi
Fabio Freschi 2019 年 10 月 20 日
I assume you have X,Y and B as created using meshgrid, and the line is specified by start/end node
% create dummy data
x = linspace(-10,30,200);
y = linspace(0,50,200);
[X,Y] = meshgrid(x,y);
% magnetic flux density
B = sin(X/2)+cos(Y/5);
% plot
figure, hold on
contourf(X,Y,B);
% line (start: first row, end: last row)
P0 = [5 35; 15 40];
% plot
plot(P0(:,1),P0(:,2),'ro-','LineWidth',2);
% evaluation points (parametric line with t in [0,1])
t = linspace(0,1,20);
P = P0(1,:)+bsxfun(@times,t(:),(P0(2,:)-P(1,:)));
plot(P(:,1),P(:,2),'*')
% use interp2 for interpolation
BLine = interp2(X,Y,H,P(:,1),P(:,2));
% plot field along the line
figure
plot(t,BLine);
  1 件のコメント
René Dienemann
René Dienemann 2019 年 10 月 24 日
Many Thanks!!! Thats what i was looking for.

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

その他の回答 (1 件)

カテゴリ

Help Center および File ExchangeSurface and Mesh Plots についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by