So i have used the cart2pol() function to obtain the polar coordinates represented by and θ. In a paper I'm analysing, it is said that the image function, will be multiplied with a matrix.
Is it possible to use in Matlab instead of the normal ?

Réponses (2)

Jackson Burns
Jackson Burns le 7 Sep 2019

0 votes

The function pol2cart might be what you are looking for.

4 commentaires

Stewart Tan
Stewart Tan le 7 Sep 2019
@Jackson Burns yes in the first example of the link, the x y coordinates are in decimals, hence trying f(x,y) gives "Array indices must be postive indices or logical values".
Walter Roberson
Walter Roberson le 7 Sep 2019
Modifié(e) : Walter Roberson le 7 Sep 2019
If your f is an array rather than a function, then f(x,y) would not be typical. The first dimension corresponds to rows and the second dimension correspond to columns, and normally rows corresponds to Y and columns corresponds to x. If your f were an array then normally you would index f(row,column) which would correspond most closely to f(y,x) .
However, rows and columns do not typically correspond to y and x, because your y and x are not typically restricted to small consecutive positive integers. You would normally have some kind of correspondance index or formula, such as
column = floor(x*10) + 51
which might be used if you were willing to approximate x by 1/10 increment for an x range starting from -5.0
If you had an array fpol then fpol(r,theta) would have similar issues to above, namely that your r and theta would be restricted to small positive integers. You would be more likely to have an fpol(rows, columns) with translation formulas such as row = 1 + r * 100 and column = floor(theta*100) + 501 to support r increments of 1/100 starting from 0 and theta increments of 1/100 starting from -5.00 .
But you really need to be clear on whether you are working with an array fpol or a polar function
When you start talking about multipling by matrices in this context, you should start suspecting that lurking somewhere around is a transformation matrix such as a rotation matrix . In such a case what you would probably be working with is a matrix with two columns of coordinates, and the matrix multiplication would transform the coordinates to new coordinates.
Stewart Tan
Stewart Tan le 7 Sep 2019
Modifié(e) : Stewart Tan le 7 Sep 2019
@Walter Roberson, spot on!! the image function is multiplied by a rotation matrix. I've been trying to figure it out for weeks now.
You will probably find that is a function that produces and coordinate pairs, and that the rotation matrix operates on those to produce and coordinate pairs
Rotation matrices can also be created in terms of polar coordinates
[r(:), theta(:), zeros(numel(r),1)] * [1 0 0; 0 1 dtheta; 0 0 1]
which would increate theta -> theta+dtheta ... though for that simple case it would typically be easier to just do theta = theta + dtheta

Connectez-vous pour commenter.

Walter Roberson
Walter Roberson le 7 Sep 2019

0 votes

If what you have is a formula in terms of x and y, and you need to convert it to polar, and you have the symbolic toolbox, then use
syms r theta
polar_formula = simplify( subs(YourFormula, {x, y}, {r*cos(theta), r*sin(theta)}) )

Catégories

En savoir plus sur Polar Plots dans Centre d'aide et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by