Plotting patters using circles and a trignometric equation

1 回表示 (過去 30 日間)
Ahmed Mohamed Mansoor
Ahmed Mohamed Mansoor 2022 年 10 月 13 日
コメント済み: Les Beckham 2022 年 10 月 18 日
So here is an image I saw:
Based on these equations we should be able to plot something like this picture.
When i coded this down I got the pattern but does not look exactly like the picture. Is there a way to tweak this?
clear; close all; clc;
k = 1:14000;
a = pi*k./14000;
Xk = cos(10*a).*(1-0.5*cos(16*a).^2);
Yk = sin(10*a).*(1-0.5*cos(16*a).^2);
Rk = 1/200 + 0.1*sin(52*a).^4;
figure()
scatter(Xk,Yk,[],Rk)
colormap(jet)
axis equal

採用された回答

Les Beckham
Les Beckham 2022 年 10 月 13 日
編集済み: Les Beckham 2022 年 10 月 13 日
k = 1:14000;
a = pi*k./14000;
Xk = cos(10*a).*(1-0.5*cos(16*a).^2);
Yk = sin(10*a).*(1-0.5*cos(16*a).^2);
Rk = 1/200 + 0.1*(sin(52*a)).^4;
figure()
% you need to specify the third argument, the size of the markers in points
% the factor 5000 is experimentally determined
scatter(Xk, Yk, Rk*5000, Rk)
colormap(jet)
axis equal
Further experimenting would be needed to figure out how to get the colors right (the 4th argument to scatter). Here the colors are mapped based on the radius.
  3 件のコメント
Ahmed Mohamed Mansoor
Ahmed Mohamed Mansoor 2022 年 10 月 18 日
1) Thank you very much for the answer.
2) in terms of the colors, I feel a "copper" colormap makes it look nicer.
3) about the colors being mapped based on radius. That does make sense but I also think there is a third dimensional aspect to it, that has to do with the color scheme based on the depth of the image.
4) I think after processing the image they must have tweaked the color scheme I guess? But will keep playing around to see what i can come up with.
note: Apologies for accepting the answer late. Was not around for a couple of days.
Les Beckham
Les Beckham 2022 年 10 月 18 日
You are quite welcome. Better late than never :)

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

その他の回答 (0 件)

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by