Plotting a bird using mathematical equation issue.
Afficher commentaires plus anciens
Hello, I saw these set of equations that plot a bird using circles (See Image Below). I was able to code it down and the plot does not seem to be correct. However, there are a few issues with my code and it would be great if anybody could help.

My questions are:
- The plot does not seem to be right when I run it (see image below). Can you please check if the code is correct to get the same plot as in the image above?
- If I wanted to animate the plot, how would I do it?
clear; close all; clc;
A =@(k) sin((pi*k)./20000);
B =@(k) cos((31*pi*k)./10000);
C =@(k) sin((6*pi*k)./10000);
D =@(k) cos((31*pi*k)./10000);
E =@(k) sin((pi/2)*((k-10000)./(10000)).^7-(pi/5));
F =@(k) cos((pi/2)*((k-10000)./(10000)).^7-(pi/5));
G =@(k) sin((3*pi*k)./20000);
H =@(k) cos((3*pi)*((k-10000)./(100000)));
I =@(k) cos((9*pi)*((k-10000)./(100000)));
J =@(k) cos((36*pi)*((k-10000)./(100000)));
K =@(k) cos(((31*pi*k)./(10000))+((25*pi)/32));
L =@(k) cos((62*pi*k)./10000);
x = 1:9830;
% these are the Xk values
Xk = A(x).^12 .* (0.5*B(x).^16.*C(x) + (1/6)*D(x).^20) + ((3*x)./20000) ...
+ B(x).^6 .*E(x);
% these are the Yk vlues
Yk = (-9/4)*B(x).^6.*F(x).*((2/3)+(A(x).*G(x)).^6) + ...
(3/4)*H(x).^10.*I(x).^10.*J(x).^14 +...
(7/10)*((x-10000)./(100000)).^2;
% This are the Rk values
Rk = A(x).^10.*((1/4)*K(x).^20 + (1/20)*B(x).^2) + (1/30).*((3/2)-L(x).^2);
figure()
scatter(Xk,Yk,[],Rk)
colormap(jet)
The plot looks like this:

Réponse acceptée
Plus de réponses (1)
Benjamin Thompson
le 5 Oct 2022
0 votes
The radius values Rk do not seem to be used properly. Are you calling scatter correctly? Looks like maybe you need three arguments instead of 4.
Catégories
En savoir plus sur Red 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!
