How to select matrix elements along aritrary angle i.e (Any angle between 0 and 90 degree except 0,90,45 deg ) ?

5 ビュー (過去 30 日間)
# clear all;
# clc;
# close all;
# [kx,ky]=meshgrid(-1:2/21:1);
#
# circ=sqrt(kx.^2+ky.^2)<1;
# alp=asin(0.95);
#
# k0=1/sin(alp);
# kz=sqrt(k0^2-(kx.^2+ky.^2));
# GX=sqrt(k0./kz).*((k0*ky.^2+kz.*kx.^2)./(k0*(kx.^2+ky.^2)));
# GY=sqrt(k0./kz).*((kz-k0).*kx.*ky)./(k0*(kx.^2+ky.^2));
# GZ=-sqrt(k0./kz).*(kx/k0);
#
# k=256;
# ph=(pi+atan2(kx,ky));
# ph=rot90(ph,3);
#
# la=cos(ph);
# lb=rot90(sin(ph), 3);
# EX=(GX.*la-rot90(GY.*lb, 3));
# EFx=fftshift(fft2(EX.*circ, k, k));
# Ix=EFx.*conj(EFx);
# EY=(GY.*la+rot90(GX.*lb, 3));
# EFy=fftshift(fft2(EY.*circ, k, k));
# Iy=EFy.*conj(EFy);
# EZ=(GZ.*la+rot90(GZ.*lb, 3));
# EFz=fftshift(fft2(EZ.*circ, k, k));
# Iz=EFz.*conj(EFz);
#
# Ir=Ix+Iy;
# I1=Ix+Iz+Iy;
#
# figure(5)
# imagesc(abs(I1)),colormap gray;axis image; axis off;
# % along central row and column
# figure(6)
# plot(I1(:,k/2),'linewidth',2)
# figure(7)
# plot(I1(:,k/2),'linewidth',2)
# % along diagonal
# figure(8)
# plot(I1(1:k+1:k^2))
Hi here I have plotted intensity(I1)long diagonal and central row and
column. i.e at 45,0,90 degrees. Now I want to plot intensity along any
arbitrary angle 10,30,60 degrees can any one help me in this regard,
it is great help for me
thanking you in advance

回答 (1 件)

Walter Roberson
Walter Roberson 2013 年 8 月 11 日
improfile() if you have the Image Processing Toolkit. If not, there are ways to proceed with interp1(). You need to decide, though, how much of a pixel needs to be "touched" for you to want to include the pixel in the plot.
  2 件のコメント
MOHD
MOHD 2013 年 8 月 11 日
編集済み: MOHD 2013 年 8 月 11 日
how can I plot the intensity along particular angle i.e 20degree like figures 6,7 and 8?
Image Analyst
Image Analyst 2013 年 8 月 11 日
With improfile, you specify the endpoints - the x,y coordinates of the end of the line. 10th grade math will let you figure those out given an angle and a point (hint: use the point-slope formula of a line). For interp1 you need to specify all the coordinates, but you can get by with just the end points if you do something like one of these:
xCoords = x1 : xStep : x2;
xCoords = linspace(x1, x2, numberOfSamplesAlongTheLine);
Do the same thing for y of course!

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

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by