Plotting patters using circles and a trignometric equation
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Ahmed Mohamed Mansoor
le 13 Oct 2022
Commenté : Les Beckham
le 18 Oct 2022
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
0 commentaires
Réponse acceptée
Les Beckham
le 13 Oct 2022
Modifié(e) : Les Beckham
le 13 Oct 2022
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 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Logical dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!