我来我网
https://5come5.cn
 
您尚未 登录  注册 | 菠菜 | 软件站 | 音乐站 | 邮箱1 | 邮箱2 | 风格选择 | 更多 » 
 

本页主题: 100FY求一道matlab题目解答。求达人指点! 显示签名 | 打印 | 加为IE收藏 | 收藏主题 | 上一主题 | 下一主题

negative



性别: 保密 状态: 该用户目前不在线
头衔: 奋斗啊~。
等级: 栋梁之材
家族: 菠韬汹勇
发贴: 943
威望: 0
浮云: 1123
在线等级:
注册时间: 2006-09-17
最后登陆: 2015-09-12

5come5帮你背单词 [ trip /trip/ n. 短程旅行 ]


100FY求一道matlab题目解答。求达人指点!

The series expansion (级数展开式) of sine function at a given x using n terms (项) is

这个附件的图。。。
(1) Write an M-file named “sine.m” which contains a function. The function computes the
value of sine function using the above expansion at a given x using n terms. In other
words (换句话说), the function sine(x,n) returns (返回) the value of the expansion at x
and the value is calculated using n terms.
(2) Matlab has a built-in (内建) sine function named “sin” which computes the value of sine
function at a given x. As you can imagine (想象), the values obtained by using theexpansion may not be the same with the results returned by the sin function used by Matlab. See the data in the following table for an example.
The number of n    Sin(π/4)    Sine(π/4,n)
        1                        0.707106… 0.785398…
    2                        0.707106… 0.704652…
    3                        0.707106… 0.707143…
    4                        0.707106… 0.707106…
    As you may have noticed from the table, for a given point π/4, the larger the number n is,
the closer the values obtained by using the expansion are to the actual values calculated
by the sin function in Matlab. Now a question rises: in order to achieve (达到) a certain
degree of accuracy (精确度), how many terms should be used in the expansion in
approximating (近似计算) the value of sine function?
To answer this question, write another M-file named “computeN.m” which finds the
number n in order to meet a required accuracy for a given point x. At some point in this
file, you should call (调用) the function in sine.m explicitly.
(3) Write a third M-file named “plotGraphs.m” which has a function taking the n as input and
plots both sin(x)-x and sine(x,n)-x on the same graph. The variable x should take the
values from -2π to 2π with the step length less than 0.1. Remember to add title, labels and
legend to the graph properly. Call this function from the function in computeN.m, so that
each time computeN(x,δ1) is executed, a graph of the two curves is plotted.
Hint: You may need to slightly (稍微地) change the function in sine.m to make it adapts
the cases that x is a vector.
(4) Run computeN(2, 10e-6) in the command window of Matlab and observe the difference
between the two curves: sin(x)-x and sine(x,n)-x.
远程图片:123.JPG
顶端 Posted: 2008-01-07 20:27 | [楼 主]
starroamer



性别: 帅哥 状态: 该用户目前不在线
等级: 栋梁之材
发贴: 845
威望: 0
浮云: 1139
在线等级:
注册时间: 2007-06-05
最后登陆: 2010-07-01

5come5帮你背单词 [ tabulate /'tæbjuleit/ vt. 将(事实、数据等)列成表,列表显示 ]


MatLab里不是有求级数的函数吗?
顶端 Posted: 2008-01-07 20:45 | [1 楼]
starroamer



性别: 帅哥 状态: 该用户目前不在线
等级: 栋梁之材
发贴: 845
威望: 0
浮云: 1139
在线等级:
注册时间: 2007-06-05
最后登陆: 2010-07-01

5come5帮你背单词 [ danger /'deind3ə/ n. 危险,危险物,威胁 ]


试试这个,不晓得我理解对了没有哈。
附件: sine.rar (1 K) 下载次数:2

顶端 Posted: 2008-01-07 21:04 | [2 楼]
starroamer



性别: 帅哥 状态: 该用户目前不在线
等级: 栋梁之材
发贴: 845
威望: 0
浮云: 1139
在线等级:
注册时间: 2007-06-05
最后登陆: 2010-07-01

5come5帮你背单词 [ spanner // n. 螺线钳 ]


Quote:
引用第28楼老子124于2008-01-07 21:01发表的  :
忘记n!的函数了,可否告知

MatLab里好像没有直接算阶乘的函数(汗),算n的阶乘可以用gamma(n+1)。
顶端 Posted: 2008-01-07 21:11 | [3 楼]
starroamer



性别: 帅哥 状态: 该用户目前不在线
等级: 栋梁之材
发贴: 845
威望: 0
浮云: 1139
在线等级:
注册时间: 2007-06-05
最后登陆: 2010-07-01

5come5帮你背单词 [ balance /'bæləns/ n. 均衡,平衡,收付平衡,收付余额,秤,天平;v. (使)保持平衡,(收支)相抵 ]


Quote:
引用第34楼老子124于2008-01-07 21:18发表的  :

这个公式是错的吧?试一个,sine(2,1)都已经大于1了

公式其实没错,不过k应该从-1算起。
书上是这样写的:sin(x)=(-1)^n*x^(2n+1)/(2n+1)!,n从0到无穷。
不过LZ的公式应该是写错了,于是我的程序也跟着错了……
顶端 Posted: 2008-01-07 21:25 | [4 楼]
starroamer



性别: 帅哥 状态: 该用户目前不在线
等级: 栋梁之材
发贴: 845
威望: 0
浮云: 1139
在线等级:
注册时间: 2007-06-05
最后登陆: 2010-07-01

5come5帮你背单词 [ limited /'limitid/ a. 小的,有限的 ]


给我吧,我用得到
顶端 Posted: 2008-01-07 21:28 | [5 楼]
starroamer



性别: 帅哥 状态: 该用户目前不在线
等级: 栋梁之材
发贴: 845
威望: 0
浮云: 1139
在线等级:
注册时间: 2007-06-05
最后登陆: 2010-07-01

5come5帮你背单词 [ talkative /'to:kətiv/ a. 喜欢讲话的,健谈的,多嘴的 ]


Quote:
引用第41楼老子124于2008-01-07 21:30发表的  :

可怜我在清水呀,要是在RX就好了

等你真的到RX了你也许就不这么想了……
顶端 Posted: 2008-01-07 21:37 | [6 楼]
starroamer



性别: 帅哥 状态: 该用户目前不在线
等级: 栋梁之材
发贴: 845
威望: 0
浮云: 1139
在线等级:
注册时间: 2007-06-05
最后登陆: 2010-07-01

5come5帮你背单词 [ correlate /'korileit/ n. 相互关联的事物;v. (使)相互关联 ]


Quote:
引用第43楼老子124于2008-01-07 21:44发表的  :

在RX了四年.............................

原来如此……
顶端 Posted: 2008-01-07 21:46 | [7 楼]
starroamer



性别: 帅哥 状态: 该用户目前不在线
等级: 栋梁之材
发贴: 845
威望: 0
浮云: 1139
在线等级:
注册时间: 2007-06-05
最后登陆: 2010-07-01

5come5帮你背单词 [ against /ə'geinst, ə'genst/ prep. 逆,反(对),违反,紧靠着,倚在,与…对照,对比 ]


Quote:
引用第45楼negative于2008-01-07 21:45发表的  :
期待有神奇的蝈蝈作出来哈。。

我写的那个有什么问题?后面画图的应该很简单,没做了。只做了计算两者之差的问题。当然公式要改一下。
顶端 Posted: 2008-01-07 21:50 | [8 楼]
我来我网·5come5 Forum » 电子设计·数学建模

Total 0.019787(s) query 6, Time now is:05-10 18:20, Gzip enabled
Powered by PHPWind v5.3, Localized by 5come5 Tech Team, 黔ICP备16009856号