MATLAB Plotting a 3D image from a matrix for a complex domain

AI Thread Summary
The discussion focuses on plotting a 3D image of a complex-valued matrix "domain" against a real-valued matrix "f". The user seeks guidance on how to visualize the complex plane defined by the "domain" matrix, with heights determined by the values in "f". Initial code snippets are provided, detailing the setup of the real and imaginary parts of the domain, as well as the random values for "f". A suggestion is made to create a table of triplets for use with ListPlot3D, which would effectively represent the data in a 3D plot. Ultimately, the user reports success with the command surf(RE_lam, IM_lam, freq) to achieve the desired visualization.
member 428835
Hi PF!

Each element of an ##n\times m## matrix is complex valued. In the following code, I call this "domain". There is also an ##n\times m## matrix that is real valued, below I call this "f". I'd like to plot a 3D image where the ##x-y## plane is the complex plain given by the coordinates "domain" who take a height f. Do you know how to do this?

Matlab:
RE_lam_end       = 30;                     
IM_lam_end       = 10;
RE_lam_start     = 0;                     
IM_lam_start     = 0;
RE_dlam          = 1;
IM_dlam          = 1;
RE_lam           = RE_lam_start:IM_dlam:RE_lam_end;
IM_lam           = IM_lam_start:RE_dlam:IM_lam_end;
domain              = RE_lam+1i*IM_lam';

f = rand(size(domain,1),size(domain,2))

I appreciate your time!
 
Physics news on Phys.org
How about making a Table to build up triplets {Re[domain[[i,j]]],Im[domain[[i,j]]],f[[i,j]]}, which you can then ListPlot3D?
 
DrClaude said:
How about making a Table to build up triplets {Re[domain[[i,j]]],Im[domain[[i,j]]],f[[i,j]]}, which you can then ListPlot3D?
Thanks for the response! I ended up using

Matlab:
surf(RE_lam,IM_lam,freq)
 

Similar threads

Replies
10
Views
3K
Replies
8
Views
2K
Replies
1
Views
2K
Replies
1
Views
2K
Replies
1
Views
2K
Back
Top