Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Error in pol2cart?

Subject: Error in pol2cart?

From: Allen

Date: 10 Oct, 2005 15:03:43

Message: 1 of 4

Hi everyone on c.ss.matlab,

I came across this lately in some of my work. [I'm taking cylindrical
coordinates and intensities from an x-ray diffraction pole-figure and
attempting to plot them in matlab.]

I have constructed a matrix consisting of (1300x3) Theta, Rho, Z data.
When I try to feed this into pol2cart, I get the following error:

 >> dataxyz = pol2cart(datacat3);
??? Input argument "r" is undefined.

Error in ==> pol2cart at 22
x = r.*cos(th);

Anyone know what might be happening here? Does the data need to be
ordered in Theta or Rho?

Thank you very much for your help!!
-Allen

Subject: Error in pol2cart?

From: PB

Date: 10 Oct, 2005 16:24:08

Message: 2 of 4

Allen wrote:
>
>
> Hi everyone on c.ss.matlab,
>
> I came across this lately in some of my work. [I'm taking
> cylindrical
> coordinates and intensities from an x-ray diffraction pole-figure
> and
> attempting to plot them in matlab.]
>
> I have constructed a matrix consisting of (1300x3) Theta, Rho, Z
> data.
> When I try to feed this into pol2cart, I get the following error:
>
> >> dataxyz = pol2cart(datacat3);
> ??? Input argument "r" is undefined.
>
> Error in ==> pol2cart at 22
> x = r.*cos(th);
>
> Anyone know what might be happening here? Does the data need to be
>
> ordered in Theta or Rho?
>
> Thank you very much for your help!!
> -Allen
>

You haven´t read the help for pol2cart have you? pol2cart requires
either two or three inputs. If you read the help you´ll probably find
out how to use the function.

/PB

Subject: Error in pol2cart?

From: Loren Shure

Date: 10 Oct, 2005 17:20:24

Message: 3 of 4

In article <dieeda$b7s$1@news.ks.uiuc.edu>, ajhalldeleteme@gmaildot.com
says...
> Hi everyone on c.ss.matlab,
>
> I came across this lately in some of my work. [I'm taking cylindrical
> coordinates and intensities from an x-ray diffraction pole-figure and
> attempting to plot them in matlab.]
>
> I have constructed a matrix consisting of (1300x3) Theta, Rho, Z data.
> When I try to feed this into pol2cart, I get the following error:
>
> >> dataxyz = pol2cart(datacat3);
> ??? Input argument "r" is undefined.
>
> Error in ==> pol2cart at 22
> x = r.*cos(th);
>
> Anyone know what might be happening here? Does the data need to be
> ordered in Theta or Rho?
>
> Thank you very much for your help!!
> -Allen
>

You are using pol2cart incorrectly. See the help for it. A hint:

theta = datacat3(:,1);
rho = datacat3(:,2);

--Loren

Subject: Error in pol2cart?

From: Allen

Date: 10 Oct, 2005 21:03:13

Message: 4 of 4

Loren Shure wrote:
> In article <dieeda$b7s$1@news.ks.uiuc.edu>, ajhalldeleteme@gmaildot.com
> says...
>
>>Hi everyone on c.ss.matlab,
>>
>>I came across this lately in some of my work. [I'm taking cylindrical
>>coordinates and intensities from an x-ray diffraction pole-figure and
>>attempting to plot them in matlab.]
>>
>>I have constructed a matrix consisting of (1300x3) Theta, Rho, Z data.
>>When I try to feed this into pol2cart, I get the following error:
>>
>> >> dataxyz = pol2cart(datacat3);
>>??? Input argument "r" is undefined.
>>
>>Error in ==> pol2cart at 22
>>x = r.*cos(th);
>>
>>Anyone know what might be happening here? Does the data need to be
>>ordered in Theta or Rho?
>>
>>Thank you very much for your help!!
>>-Allen
>>
>
>
> You are using pol2cart incorrectly. See the help for it. A hint:
>
> theta = datacat3(:,1);
> rho = datacat3(:,2);
>
> --Loren

AH HA HA !!! :) YES!! Thank you for solving this!! Ha ha. :)
Although, I have to admit, isn't it a simple issue to expect if I'm
passing an [Nx3] matrix, that most likely the x3 = each individual
input? Kinda strange. I just assumed a x2 would be treated as polar
and x3 as the cylindrical. No bother, however, it's solved. :)
[Actually, saves me a friggin step- as I cat'd them in the first place.]

BUT, my hat's off to you, Loren, as well as PB! I made a stupid
mistake, and you found it immediately!

My very best thanks to you guys! I'm glad I'm the stupid one and it's
not the function. ;)

Finally-- now I can plot the darned thing. ;)

Cheers!
-Allen

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us