资源简介
运行此程序即可听到生日祝福的音乐,并且带有动感的生日蛋糕画面!

代码片段和文件信息
% Following code bakes a birthday cake for someone special to whom you
% wanna surprise on his/her birthday with a cake in MATLAB ;)
%
% This is a chocolate flavored cake decorated with cheries on top ......
% yyuummmyy :) :)
%
% Lighted birthday candle has been put up on cake; Think of a wish and blow
% off candle by clicking on flame (yellowish in colour)... and here comes
% the celebration with birthday song.. :) :) .. Wish you a very very happy
% birthday..
%
% While running code make sure that PC speakers are ON
%
% Cake prepared by Amol G. Mahurkar
%
% Birthday_gift.m Revisions
%
% Version 1.2 04/25/2013 A/V sync
%
% Version 1.1 12/19/2011
%
% Version 1.0 10/28/2011
%
% Please suggest some extra features you think should be in this birthday gift
%
%%
function Birthday_gift()
clc; clear; close all;
instruc = [‘Happy Birthday !!!!‘char(10)char(10)...
‘Here is a birthday cake for someone special‘char(10)char(10)...
‘Make sure that PC speakers are ON‘char(10)char(10)...
‘This cake has following features:‘char(10)...
‘1. Chocolate flavored... and yummy :) :) ‘char(10)...
‘2. Decorated with cheries :) :)‘char(10)...
‘3. Lighted birthday candle on top of it‘char(10)char(10)...
‘Think of a wish and‘char(10)...
‘Blow off candle by clicking on flame (yellowish in colour obviously)‘char(10)...
‘Enjoy your birthday cake!!!‘char(10)char(10)...
‘And ya wish you a very happy birthday‘];
if(~strcmp(‘Ok‘questdlg(instruc‘Surprise !!!!!‘‘Ok‘‘Cancel‘‘Ok‘)))
quit;
end
global bday_name;
global your_name;
temp = inputdlg({‘Birthday boy/girl name:‘‘Best Wishes from:‘});
bday_name = temp{1};
your_name = temp{2};
clear temp;
%% base
n = 20;
theta = (0:n)/n*2*pi;
sintheta = sin(theta); sintheta(n+1) = 0;
m = 11;
r = ones(1m)‘;
x1 = r * cos(theta);
y1 = r * sintheta;
z1 = (0:m-1)‘/(m-1) * ones(1n+1);
r = [1 1 linspace(0.809)]‘;
x2 = r * cos(theta);
y2 = r * sintheta;
z2 = ones(1121);
%% Cherry
theta = (-n:2:n)/n*pi;
phi = (-n:2:n)‘/n*pi/2;
cosphi = cos(phi); cosphi(1) = 0; cosphi(n+1) = 0;
sintheta = sin(theta); sintheta(1) = 0; sintheta(n+1) = 0;
x3 = 0.1.*cosphi*cos(theta);
y3 = 0.1.*cosphi*sintheta;
z3 = 0.1.*sin(phi)*ones(1n+1);
%% Candle
x4=0.05.*ones(m1)*cos(theta) + 0.5;
y4=0.05.*ones(m1)*sintheta + 0.5;
z4 = (0:m-1)‘/(m-1) * ones(1n+1) + 0.5;
r11=linspace(0.05010);
r11=[0.05 r11];
r11=r11‘;
x5=r11*cos(theta) + 0.5;
y5=r11*sintheta + 0.5;
z5 = linspace(1.51.811)‘ * ones(1n+1);
%% Flame
theta = (-n:2:n)/n*pi;
phi = (-n:2:n)‘/n*pi/2;
cosphi = cos(phi); cosphi(1) = 0; cosphi(n+1) = 0;
sintheta = sin(theta); sintheta(1) = 0; sintheta(n+1) = 0;
x6 = 0.04.*cosphi*cos(theta) + 0.5;
y6 = 0.04.*cosphi*sintheta + 0.5;
z6 = (linspace(1.7221)‘)*ones(1n+1);
%% Cake
[figure1 axes1] = figureset();
cake_w_flame(x1x2x3x4x5x6y1y2y3y4y5y6z1z2z3z4
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2013-05-21 15:25 生日祝福音乐动画\
文件 504876 2010-07-09 23:25 生日祝福音乐动画\bday_song_8bit_11025.mat
文件 6511 2013-04-25 22:35 生日祝福音乐动画\Birthday_gift.m
文件 962 2013-04-25 22:28 生日祝福音乐动画\Instructions.txt
文件 1313 2013-04-25 13:11 生日祝福音乐动画\license.txt
文件 35793 2011-10-29 01:16 生日祝福音乐动画\screenshot_cake.jpg
- 上一篇:浮点转定点原理及Matlab例码
- 下一篇:用MATLAB生成OFDM信号
相关资源
- matlab_OFDM调制解调(来自剑桥大学)
- Matlab路面裂缝识别69319
- 高灵敏度GPS接收机MATLAB仿真,附捕获
- 基于MATLAB的质点弹道计算与外弹道优
- 阵列天线的matlab仿真
- MATLAB 经典程序源代码大全
- MATLAB小波软阈值去噪代码33473
- 天线阵的波束形成在MATLAB仿真程序及
- 非线性SVM算法-matlab实现
- 《MATLAB 智能算法超级学习手册》-程序
- 组合导航matlab程序
- 读取txt文件内容matlab代码实现
- Matlab实现基于相关的模板匹配程序
- matlab优化工具箱讲解
- 基于MATLAB的快速傅里叶变换
- 光纤传输中的分布傅立叶算法matlab实
- 基于matlab的图像处理源程序
- matlab 椭圆拟合程序
- 算术编码解码matlab源代码
- optical_flow 光流法 matlab 实现程序
- 引导图像滤波器 Matlab实现
- 分形几何中一些经典图形的Matlab画法
- OFDM系统MATLAB仿真代码
- SVM工具箱(matlab中运行)
- 图像小波变换MatLab源代码
- LU分解的MATLAB实现
- 冈萨雷斯数字图像处理matlab版(第三
- 替代数据法的matlab程序
- 用matlab实现的多站定位系统性能仿真
- 通过不同方法进行粗糙集属性约简m
评论
共有 条评论