## Matlab

Moderators: None (Apply to moderate this forum)
Number of posts: 2178

This Forum Only

matlab complex function plot Posted by idude on 25 Sept 2012 at 11:19 AM
1. Plot the amplitude of the complex function G(x,w)=xexp(-lR)/R^2, l=iw/c, R=sqrt(x^2+y^2+z^2), for -100<x<100 with 200 points, for -90<y<90 with 180 points, for z=100, w=1000, c=1500. Use the meshgrid option to be able to compute G and plot the result using ' imagesc'. annotate the axes

2. Plot the phase of G(x,w) as a function of x and y. Use ‘lookfor phase angle’ to find out how to compute the phase of complex numbers.

here is my approach to question 1

x=linspace(-100,100,200);
y=linspace(-90,90,180);
z=100;
w=1000;
c=1500;
[X,Y,Z]=meshgrid(x,y,z);
R=sqrt(X.^2+Y.^2+Z.^2);
G=X.*exp(-1i*w/c*R)./R.^2
figure, imagesc(x,y,real(G))
xlabel('X-axis'), ylabel('Y-axis')

idude matlab complex function plot on 25 Sept 2012 at 11:19 AM

## Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic