フィルターのクリア

How do I print coordinates in an (x, y, z) form?

5 ビュー (過去 30 日間)
TheSaint
TheSaint 2024 年 2 月 2 日
回答済み: Stephen23 2024 年 2 月 2 日
r = sqrt((x^2)+(y^2)+(z^2));
lambda = atan(y/x);
phi = asin(z/r);
fprintf('Our rectangular coordinates converted to cylindrical coordinates are %0.2f', r )
This is my current code, and it successfully prints out the first value, r, but I am not sure how to make it print in this way: (r, lambda, phi)

回答 (1 件)

Stephen23
Stephen23 2024 年 2 月 2 日
r = pi;
lambda = sqrt(2);
phi = exp(1);
fprintf('Our rectangular coordinates converted to cylindrical coordinates are (%0.2f,%0.2f,%0.2f)', r, lambda, phi )
Our rectangular coordinates converted to cylindrical coordinates are (3.14,1.41,2.72)

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

タグ

製品


リリース

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by