资源简介
运行此程序即可听到生日祝福的音乐,并且带有动感的生日蛋糕画面!
代码片段和文件信息
% 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例码
- matlab下小波图像融合几种代码
- 提取圆matlab (算法是改进后的霍夫曼
- 基于元胞自动机的Matlab单双道交通流
- matlab实现汉明编码
- 四阶超混沌映射matlab代码
- 双向全桥DC-DC双重移相控制matlab仿真
- 用matlab实现汉字的笔画细化算法.zip
- matlab数学规划常见题目代码.zip
- 图像增强源代码Matlab实现
- Matrix completion & Tensor completion经典算法
- matlab实现RGB、HSI、YCbCr之间的转换以及
- matlab圈出照片中人脸和五官的位置
- matlab之循环卷积自写
- 用MATLAB实现遗传算法程序
- MATLAB实现卷积码编译码
- 基于matlab的蚁群算法和仿真结果图
- matlab实现ASK调制解调
- 云模型的matlab程序
- PSCAD与MATLAB的在线连接仿真
- 雷达回波仿真 matlab源程序
- matlab求已知数据点的拉格朗日插值多
- 遗传算法优化的BP神经网络 - MATLAB源码
- 机器人 编队 蜂拥 matlab 仿真
- MATLAB读取整个文件夹或多个文件夹内
- 基于MATLAB的BP神经网络的臭氧总量预测
- Matlab-Wifi仿真
- m序列发生器
- 802.11a OFDM matlab
评论
共有 条评论