complex-numbers

Plotting the branches of a complex function

纵然是瞬间 提交于 2021-01-21 11:22:17
问题 I'm trying to plot a kind of Riemann's surface of a function (I'm not sure if it's the right name for the thing), as shown below: Here's what I tried: r = (0:1:15)'; % create a matrix of complex inputs theta = pi*(-1:0.05:1); z = r*exp(1i*theta); w = z.^(1/2) ; % calculate the complex outputs figure('Name','Graphique complexe','units','normalized','outerposition',[ 0.08 0.1 0.8 0.55]); subplot(121) surf(real(z),imag(z),real(w),imag(w)) % visualize the complex function using surf xlabel('Real

Plotting the branches of a complex function

删除回忆录丶 提交于 2021-01-21 11:21:45
问题 I'm trying to plot a kind of Riemann's surface of a function (I'm not sure if it's the right name for the thing), as shown below: Here's what I tried: r = (0:1:15)'; % create a matrix of complex inputs theta = pi*(-1:0.05:1); z = r*exp(1i*theta); w = z.^(1/2) ; % calculate the complex outputs figure('Name','Graphique complexe','units','normalized','outerposition',[ 0.08 0.1 0.8 0.55]); subplot(121) surf(real(z),imag(z),real(w),imag(w)) % visualize the complex function using surf xlabel('Real

Calculate covariance matrix for complex data in two channels (no complex data type)

两盒软妹~` 提交于 2021-01-20 20:32:08
问题 I have complex-valued data given in 2 channels of a matrix (one is the real, one the imaginary part, so the matrix dimensions are (height, width, 2) , since Pytorch does not have native complex data types. I now want to calculate the covariance matrix. The stripped-down numpy calculation adapted for Pytorch is this: def cov(m, y=None): if m.ndimension() > 2: raise ValueError("m has more than 2 dimensions") if y.ndimension() > 2: raise ValueError('y has more than 2 dimensions') X = m if X

Calculate covariance matrix for complex data in two channels (no complex data type)

好久不见. 提交于 2021-01-20 20:31:23
问题 I have complex-valued data given in 2 channels of a matrix (one is the real, one the imaginary part, so the matrix dimensions are (height, width, 2) , since Pytorch does not have native complex data types. I now want to calculate the covariance matrix. The stripped-down numpy calculation adapted for Pytorch is this: def cov(m, y=None): if m.ndimension() > 2: raise ValueError("m has more than 2 dimensions") if y.ndimension() > 2: raise ValueError('y has more than 2 dimensions') X = m if X

Assigning variable number to complex array

本秂侑毒 提交于 2020-12-25 09:54:07
问题 I want to assign complex array as variable. My code is like complex indx(3,3) integer i,j do i=1,3 do j=1,3 indx(i,j) = (i,j) write(*,*) indx(i,j) end do end do and in this case I am getting an error like A symbol must be a defined parameter in this context. [I] indx(i,j) = (i,j) 回答1: You must use function cmplx to build a complex value you want to assign. complex indx(3,3) integer i,j do i=1,3 do j=1,3 indx(i,j) = cmplx(i,j) write(*,*) indx(i,j) end do end do The syntax you tried is only