Plotting a bird using mathematical equation issue.
9 次查看(过去 30 天)
显示 更早的评论
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:
0 个评论
采纳的回答
KSSV
2022-10-5
You need to modify the radius Rk so that, it gives the look.
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*8000,Rk)
colormap(jet)
axis equal
5 个评论
更多回答(1 个)
Benjamin Thompson
2022-10-5
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.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Orange 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!