Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to draw Cherry Blossom with Python and Matlab

2025-04-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article introduces the knowledge of "how to draw cherry blossoms with Python and Matlab". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

1. Brocade is short and love is long.

Why choose this title, draw lessons from the love letter in a love letter, but also kiss you thousands of.

Brocade is short and love is long.

It is only said that people walk cool tea, how do you feel that brocade is short and affection is long?

When it comes to tears, is it the heart of the bright moon?

two。 A Sakura Rain (Matlab)

Function pingbahold on,axis equalaxis (0.5 + [- 10 ytick', 50]) set (gca,'xtick', [], 'ytick', [],' xcolor','w','ycolor','w') set (gca,'color', [0.5020 0.5020 0.5020]) length_trunk=6;width_trunk=4;k1=0.9;k2=0.8;number_branch=15;alp=pi/10;length_branch=k1*length_trunk;width_branch=k2*width_trunk;trunk= Plot (trunk (:, 1), trunk (:, 2), 'color', [0 000],' Linewidth',width_trunk) begins= [trunk (2 grow:), pi/2,1]; grow=begins;plotdata= [0 000 000]; plotdata (1 line:) = []; for i=1:number_branch control=randi (25, [length (grow (:, 1), 1]) > = 10; ag=grow (:, 3); l=length (ag) Parta= [length _ branch.* k1 ^ alp (:, 4). * cos (ag+ones (lmagin1) * alp), length_branch.* k1.^ alp (:, 4). * sin (ag+ones (lmage1) * alp), ones (lmem1) * alp,ones (lmage1)] Partb= [length _ branch.* k1 ^ alp (:, 4). * cos (ag-ones (lmagin1) * alp), length_branch.* k1 ^ alp (:, 4). * sin (ag-ones (lmag1) * alp),-ones (lmag1) * alp,ones (lmag1)] Parta2= [0.8. * length_branch.* k1 ^ sin (:, 4). * cos (ag), 0.8.roomthymbranch.k1.^ (:, 4). * sin (ag), zeros (lprit 1), ones (lMagol 1)] Partb2= [0.8. * length_branch.* k1.^ (:, 4). * cos (ag), 0.8.roomthumbbranch.k1.^ (:, 4). * sin (ag), zeros (lmage1), ones (lmage1)]; parta=control.*parta+ (1-control). * parta2; partb=control.*partb+ (1-control). * partb2; parta=parta+grow; partb=partb+grow; congress= [parta;partb]; grow= [grow;grow] Judge= [grow,congress]; judge=unique (judge,'rows'); grow=judge (:, 5:end); plotdata= [plotdata;judge]; endfor i=1:number_branch temp_w=width_branch* 0.8 ^ I; temp_branch=plotdata (plotdata (:, 4) = = I branch:); plx= [temp _ branch (:, 1), temp_branch (:, 5)]; ply= [temp _ branch (:, 2), temp_branch (:, 6)]; plx=plx';ply=ply' Plot (plx,ply,'color', [0.3020 0.3020] + I * [0.3020 0.6824 0.6824]. / number_branch,'Linewidth',temp_w) end bloom_pos=plotdata (plotdata (:, 8) = = number_branch+1, [5je 6]); scatter (bloom_pos (:, 1), bloom_pos (:, 2), 10 bloom_pos=plotdata bloom_pos=plotdata (plotdata (:, 8) = = number_branch, [5Power6]) Scatter (bloom_pos (:, 1), bloom_pos (:, 2), 8 end3. Sakura tree (Python)

Import turtle as Timport randomimport time # = painting the torso of cherry blossoms (60 import turtle as Timport randomimport time t) = T.title ('fallen cherry blossoms') def Tree (branch, t): time.sleep (0.0005) if branch > 3: if 8

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report