MATLAB的问题,那位大侠能帮个忙,后天就要交作业了,1.The Fibonacci numbers are computed according to the following relation:with F0=F1=1.(1) Write a function,F=fibo(n),to generate Fibonacci numbers in a vector F.Compute the first 10 Fi

来源:学生作业帮助网 编辑:作业帮 时间:2024/04/28 23:51:21
MATLAB的问题,那位大侠能帮个忙,后天就要交作业了,1.The Fibonacci numbers are computed according to the following relation:with F0=F1=1.(1) Write a function,F=fibo(n),to generate Fibonacci numbers in a vector F.Compute the first 10 Fi

MATLAB的问题,那位大侠能帮个忙,后天就要交作业了,1.The Fibonacci numbers are computed according to the following relation:with F0=F1=1.(1) Write a function,F=fibo(n),to generate Fibonacci numbers in a vector F.Compute the first 10 Fi
MATLAB的问题,那位大侠能帮个忙,后天就要交作业了,
1.The Fibonacci numbers are computed according to the following relation:
with F0=F1=1.
(1) Write a function,F=fibo(n),to generate Fibonacci numbers in a vector F.Compute the first 10 Fibonacci numbers using the function;
(2) For the first 50 Fibonacci numbers,compute the ratio
It is claimed that this ratio approaches the value of the golden mean .What do your results show?
2.(Optional) Zeller's Congruence is a formula that calculates the day of the week given the date (within a limited range of years).The formula is:
day = 1 + ([2.6m - 0.2] + d + y + [y/4] + [c/4] - 2c) modulo 7
where the square brackets mean take the integer part,modulo 7 means the remainder when divided by 7,and
d = day of the month (e.g.1 to 31)
m = month number with March=1,...,December=10,January=11,
February=12.Assign January and February to previous year.
c = century number (e.g.19)
y = year in century (e.g.97),but remember January and February
The result is the day of the week,with 1=Sunday.Write a function dayofweek which takes a vector of three numbers representing the day,month and year in conventional notation,and returns a string containing the name of the day of the week.For example (attack on Pearl Harbour):
dayofweek([7 12 1941])
ans=
Sunday
(Hints:use Matlab function rem and fix)

MATLAB的问题,那位大侠能帮个忙,后天就要交作业了,1.The Fibonacci numbers are computed according to the following relation:with F0=F1=1.(1) Write a function,F=fibo(n),to generate Fibonacci numbers in a vector F.Compute the first 10 Fi
咋又来问了,我不是已经帮你做好了吗?
第1题 建立如下的m文件(知道怎么建m文件吗,file->new->m-file,然后把下面的东西敲进去,然后保存file->save,文件名就叫fibo.m)
function f=fibo(n)
if n==0
f=1;
else
if n==1
f=[1 1];
else
temp=fibo(n-1);
f=[temp,temp(end)+temp(end-1)];
end
end
下面是答案
第(1)小题
在命令行里敲
fibo(9)
屏幕就会显示
ans =
1 1 2 3 5 8 13 21 34 55
第(2)小题
在命令行里敲
a=fibo(50);
fibo(49)./a(2:end)
屏幕就会显示
ans =
Columns 1 through 9
1.0000 0.5000 0.6667 0.6000 0.6250 0.6154 0.6190 0.6176 0.6182
Columns 10 through 18
0.6180 0.6181 0.6180 0.6180 0.6180 0.6180 0.6180 0.6180 0.6180
Columns 19 through 27
0.6180 0.6180 0.6180 0.6180 0.6180 0.6180 0.6180 0.6180 0.6180
Columns 28 through 36
0.6180 0.6180 0.6180 0.6180 0.6180 0.6180 0.6180 0.6180 0.6180
Columns 37 through 45
0.6180 0.6180 0.6180 0.6180 0.6180 0.6180 0.6180 0.6180 0.6180
Columns 46 through 50
0.6180 0.6180 0.6180 0.6180 0.6180
下面你就在作业本上写
We can find the ratio approaches the value of the golden mean.
第2题
建立如下m文件
function day=dayofweek(x)
d=x(1);m=mod(x(2)-2,12);
yy=x(3);
if m>10
yy=yy-1;
end
y=rem(yy,100);
c=floor(yy/100);
switch mod(1+(floor(2.6*m -0.2)+d+y+floor(y/4)+floor(c/4)-2*c),7)
case 1
day='Sunday';
case 2
day='Monday';
case 3
day='Tuesday';
case 4
day='Wednesday';
case 5
day='Thursday';
case 6
day='Friday';
case 0
day='Saturday';
end
下面是例子
在命令行里面敲
dayofweek([8 6 2008])
屏幕就会显示
ans =
Sunday

钢板冷轧后温度那位大侠知道钢板冷轧后的温度? MATLAB的问题,那位大侠能帮个忙,后天就要交作业了,1.The Fibonacci numbers are computed according to the following relation:with F0=F1=1.(1) Write a function,F=fibo(n),to generate Fibonacci numbers in a vector F.Compute the first 10 Fi Matlab中,关于曲线拟合的问题!那位高手帮我做一下这个matlab的曲线拟合问题!hx=[137.7699554137.7719955137.7634158137.2436762136.8213823137.1116036136.8567032136.810182136.3980186136.2150053136.1752496135.8923706135.7208186135.2 做人的内涵是什么?先做人后做事是什么意思.在管理和销售等等许多问题中,最后都会涉及到怎样做人.潜台词是什么.做人的内涵又是什么,那位大侠来诠释下. 那位大侠知道脂肪的检测标准 国标的 雨花石 石头,李玉刚 雨花石的的歌词 那位大侠 英语翻译谢谢帮那位大侠!帮下小的! 那位大侠有拟薄水铝石的标准Q/ChalcoA020-2004 医用钛合金的成分表那位大侠有啊? 那位大侠说一下先天下之忧而忧,后天下之乐而乐的看法? 那位大侠有鉴相器的电路图要有参数啊 关于双氧水的密度问题?那位大侠知道关于双氧水的尝试很密度问题,比如一立方多少吨,有知道的告诉在下一声, MATLAB解一个解方程组的问题.包含两个if语句.M文件如下,请大侠帮忙.run后发现第二个if那句有问题.什么原因.其次就是第二个方程组能不能这样用solve语句表示.注:第二个if语句之前的应该没有 egbupdate 1.0 那位大侠知道 关于MATLAB:line(t+.06,sin(t),'LineWidth',4,'Color',[.8 .8 .8]);那位大侠知道呀,请指导下细佬!是在帮助文档里的一句话,关于line函数 哪位大侠知道古埃及太阳神拉神旁边那位是谁?古埃及太阳神旁边那位女的是谁? 冒顿给吕后的信我一直在找冒顿大单于给吕后写的那封信和吕后的回信.请那位大侠帮帮我.我要原文. 那位知道圆周率3.14的后30位?