超级电脑白痴 发表于 2008-11-4 14:04

求助高手!作业不会做,一直出错

第一题:求前10项的和:a(k+1)=a(k)*base

% calculates sum of first 10 values of the following series
a=[];
a(1)=input('input values a(1)');
base=input('input values base');
Sum=a(1);
for i=2:10
a(i)=a(i-1)*base;
Sum=Sum+a(i);
end;
plot(a);



输进去就报错:???In an assignmentA(I) = B, the number of elements in B and
I must be the same.

不懂怎么找a(1)和base..

第二题:见图,points)Archimedes’ Theorem: The total area under the parabola is 4/3 of the area of the blue
triangle.
Assuming that the triangle has area 1, the total area is an infinite sum
...1+2(1/8)+4(1/8)^2+8(1/8)^#
The first term represents the area of the triangle, the second term the
areas of the two green triangles, and so on.
Write a function which calculates an approximation of an area under
parabola (width and height defined by user) using the series above.
A value of approximation error should also be defined by user.
Plot the error of approximation (absolute value) as a function of
number of elements of the series.



基本没搞懂题目,高手帮忙把,跪求了...........

第三题:n^m 图2
基本上...比第二题还要不懂

ChaChing 发表于 2008-11-4 16:15

for problem 1
a=input('input values a(1)'); base=input('input values base');
Sum=a(1); for i=2:10, a(i)=a(i-1)*base; Sum=Sum+a(i); end;
plot(a);

其他自己试

[ 本帖最后由 ChaChing 于 2008-11-4 16:18 编辑 ]

超级电脑白痴 发表于 2008-11-4 16:35

原帖由 ChaChing 于 2008-11-4 16:15 发表 http://www.chinavib.com/forum/images/common/back.gif
for problem 1
a=input('input values a(1)'); base=input('input values base');
Sum=a(1); for i=2:10, a(i)=a(i-1)*base; Sum=Sum+a(i); end;
plot(a);

其他自己试
谢谢了。。。不是我不想试,其实是我们老师不教,就让我们自己做,我又没学过,所以看了题目也不知道怎么做。。。

sigma665 发表于 2008-11-4 17:42

第二题是让你写出这个东西面积的近似表达式,并给出误差
第3题应该是让你写程序来计算这个面积

jww100 发表于 2008-11-5 03:10

原帖由 超级电脑白痴 于 2008-11-4 16:35 发表 http://www.chinavib.com/forum/images/common/back.gif

谢谢了。。。不是我不想试,其实是我们老师不教,就让我们自己做,我又没学过,所以看了题目也不知道怎么做。。。

汗,还有这样的老师

yufeng 发表于 2008-11-5 09:21

第二个就是求那个数列的值,第三个就是按照给的流程来编程序,看了下大概意思是对A进行操作,应该和第二个没有关系

LFU0795 发表于 2008-11-5 09:35

你那是什么题啊

http://p8.images22.51img1.com/6000/qwb654/852fad10dd443bb0292fff0ca514f90d.gif
盘龙 星辰变后传

[ 本帖最后由 sigma665 于 2008-11-5 20:53 编辑 ]

超级电脑白痴 发表于 2008-11-5 14:36

原帖由 LFU0795 于 2008-11-5 09:35 发表 http://www.chinavib.com/forum/images/common/back.gif
你那是什么题啊


http://p8.images22.51img1.com/6000/qwb654/852fad10dd443bb0292fff0ca514f90d.gif
盘龙 星辰变后传 ...
我们大学数学系的电脑课作业,,,,,,,,,说是说作业,可是我们从开学就上过一次课...

超级电脑白痴 发表于 2008-11-5 17:06

原帖由 sigma665 于 2008-11-4 17:42 发表 http://www.chinavib.com/forum/images/common/back.gif
第二题是让你写出这个东西面积的近似表达式,并给出误差
第3题应该是让你写程序来计算这个面积
不好意思,误差还是不会求.............

mybromine 发表于 2008-11-9 10:40

原帖由 jww100 于 2008-11-5 03:10 发表 http://www.chinavib.com/forum/images/common/back.gif


汗,还有这样的老师
我们学校就这样
什么都没教,连c语言都没给我们上,就直接学了用MATLAB仿真系统,搞得每个人都透大死了

ch_j1985 发表于 2008-11-9 11:23

回复 8、10楼 mybromine 的帖子

如果老师教,保证就会做了吗?
不管是学什么,自己有学习的主动性才是重要的……

科技在线 发表于 2008-11-9 12:30

其实老师教了也没有多大用
多看点例题就行,先有个主观认识,然后再去做

ChaChing 发表于 2008-11-11 22:51

for problem 2
function areaAll = area_parabola_1(ErrCr)
areaAll=1; areaF=1; AbsErr=1; ratio=1/4; Sn=areaAll;
while AbsErr > ErrCr, areaF=areaF*ratio;
   areaAll = areaAll+areaF; AbsErr=areaF; Sn=; end
for k=1:length(Sn), AbsErr=areaAll-Sn; bar(AbsErr); end
真的不确定是否楼主要的
页: [1]
查看完整版本: 求助高手!作业不会做,一直出错