How to select matrix elements along aritrary angle i.e (Any angle between 0 and 90 degree except 0,90,45 deg ) ?
조회 수: 1 (최근 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
댓글 수: 0
답변 (1개)
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
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 Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!