I am trying to plot z^(1/3) using cplxmap. However, whenever I run my code, I recieve the following errors that are occuring in the function cplxmap:
Error using mesh (line 79)
Z must be a matrix, not a scalar or vector
Error in cplxmap (line 31)
mesh(x,y,m*s,blue*s);
Error in paper (line 16)
cplxmap(z, w)
The code I am running is:
clear all
close all
r = linspace(0, 1, 1000); % radius vector
theta = linspace(0, 2*pi, 1000); % angle vector
z = r.*exp(1i*theta); % defines cplxgrid
x = real(z); % real z
y = imag(z); % imaginary z
w = z.^(1/3); % w = z^(1/3)
u = real(w); % real w
v = imag(w); % imaginary w
figure(1);
cplxmap(z, w)
colormap(jet)

3 件のコメント

chadi cream
chadi cream 2016 年 8 月 26 日
z must me a matrix not a vector. in your case it is a vector, same as r and theta.
chadi cream
chadi cream 2016 年 8 月 26 日
編集済み: chadi cream 2016 年 8 月 26 日
you can
z=cplxgrid(10); w=z.^(1/3); cplxmap(z, w)
Caba
Caba 2017 年 8 月 10 日
You have to create a meshgrid (matrix) from the two column vectors, r and theta. Reduce the number of elements from 1000 to something more manageable, e.g. 51. Try different values in R=linspace(0,1,M), like M=21,51,101
R = linspace(0, 1, 51); % radius vector Theta = linspace(0, 2*pi, 51); % angle vector [r,theta] = meshgrid(R,Theta); % creating a meshgrid

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

 採用された回答

Star Strider
Star Strider 2014 年 10 月 4 日

1 投票

A bit further down in the documentation for that example, it mentions cplxroot. See if:
cplxroot(3)
does what you want. If you want to generate your own plot, in that example ‘z’ is generated by the cplxgrid function.

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File Exchange で Creating and Concatenating Matrices についてさらに検索

質問済み:

2014 年 10 月 4 日

コメント済み:

2017 年 8 月 10 日

Community Treasure Hunt

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

Start Hunting!

Translated by