How to rotate array values around origin with another arrays value as angle.
1 回表示 (過去 30 日間)
古いコメントを表示
Hi!
My question is:
I have a Distance=[1x31 double], contains values from 0.07 to 0.3, which should be the distance from origin
And a VinkelPosMotorA=[1x31 double], the values in the arrays are different. VinkelPosMotorA contains some values between 0 to 360.
I want to plot Distance around origin(0,0) with degrees in VinkelPosMotorA with regards to the origin
I have tried the rotate function but it doesnt calculate for every value in VinkelPosMotorA
If done correctly i should end up with a plot that starts at a point and ends close to that point(0:360 degrees)
What i essentially want is to stretch an almost linear graph around (0,0) so i end up with something that looks like a square.
Thanks in advance!
Picture that probably explains what i mean better:
0 件のコメント
回答 (1 件)
Amanpreetsingh Arora
2020 年 11 月 9 日
You can use “pol2cart” function to convert the data from polar coordinates to cartesian coordinates and then plot using “plot”.
For your example,
[X,Y]=pol2cart(VinkelPosMotorA*pi/180,Distance);
plot(X,Y)
The documentation for "pol2cart" can be found as follows:
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Scatter Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!