声振论坛

 找回密码
 我要加入

QQ登录

只需一步,快速开始

查看: 1256|回复: 12

[编程技巧] 求助高手!作业不会做,一直出错

[复制链接]
发表于 2008-11-4 14:04 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?我要加入

x
第一题:求前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 assignment  A(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
基本上...比第二题还要不懂
1.jpg
2.jpg
回复
分享到:

使用道具 举报

发表于 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 编辑 ]

评分

1

查看全部评分

 楼主| 发表于 2008-11-4 16:35 | 显示全部楼层
原帖由 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);

其他自己试

谢谢了。。。不是我不想试,其实是我们老师不教,就让我们自己做,我又没学过,所以看了题目也不知道怎么做。。。
发表于 2008-11-4 17:42 | 显示全部楼层
第二题是让你写出这个东西面积的近似表达式,并给出误差
第3题应该是让你写程序来计算这个面积

评分

1

查看全部评分

发表于 2008-11-5 03:10 | 显示全部楼层
原帖由 超级电脑白痴 于 2008-11-4 16:35 发表

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


汗,还有这样的老师
发表于 2008-11-5 09:21 | 显示全部楼层
第二个就是求那个数列的值,第三个就是按照给的流程来编程序,看了下大概意思是对A进行操作,应该和第二个没有关系

评分

1

查看全部评分

发表于 2008-11-5 09:35 | 显示全部楼层
你那是什么题啊


                               
登录/注册后可看大图

盘龙 星辰变后传

[ 本帖最后由 sigma665 于 2008-11-5 20:53 编辑 ]
 楼主| 发表于 2008-11-5 14:36 | 显示全部楼层
原帖由 LFU0795 于 2008-11-5 09:35 发表
你那是什么题啊



                               
登录/注册后可看大图

盘龙 星辰变后传 ...

我们大学数学系的电脑课作业,,,,,,,,,说是说作业,可是我们从开学就上过一次课...
 楼主| 发表于 2008-11-5 17:06 | 显示全部楼层
原帖由 sigma665 于 2008-11-4 17:42 发表
第二题是让你写出这个东西面积的近似表达式,并给出误差
第3题应该是让你写程序来计算这个面积

不好意思,误差还是不会求.............
发表于 2008-11-9 10:40 | 显示全部楼层
原帖由 jww100 于 2008-11-5 03:10 发表


汗,还有这样的老师

我们学校就这样
什么都没教,连c语言都没给我们上,就直接学了用MATLAB仿真系统,搞得每个人都透大死了
发表于 2008-11-9 11:23 | 显示全部楼层

回复 8、10楼 mybromine 的帖子

如果老师教,保证就会做了吗?
不管是学什么,自己有学习的主动性才是重要的……
发表于 2008-11-9 12:30 | 显示全部楼层
其实老师教了也没有多大用
多看点例题就行,先有个主观认识,然后再去做

评分

1

查看全部评分

发表于 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=[Sn, areaAll]; end
for k=1:length(Sn), AbsErr=areaAll-Sn; bar(AbsErr); end
真的不确定是否楼主要的
您需要登录后才可以回帖 登录 | 我要加入

本版积分规则

QQ|小黑屋|Archiver|手机版|联系我们|声振论坛

GMT+8, 2024-9-23 01:34 , Processed in 0.082401 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表