查看单个帖子
旧 2007-12-23, 19:28   #1
陆羽樊
初级会员
 
注册日期: 2007-12-23
帖子: 5
声望力: 0
陆羽樊 正向着好的方向发展
默认 【求助】请帮忙解决一道有关m-file的函数画图题

问题:
The when it is compressed by an amount x m by the mass, the force, F(x), in the spring is given to be F(x) =k1x^a+k2x^b. Produce a plot showing the variation of F vs. x for 0<=x<=6h

我自己做的,但是怎么都不对,请帮忙纠正
function [f]=f(x)
k1=45000*(1+3)
k2=8100*(1+4)
a=1+0.01*1
b=1.5+0.01*3
f=k1.*x.^a+k2.*x.^b
c=0;
d=6*h;
n=100;
for i=1:n
x=c+(i-1)*d/n;
f_plot=f(x);
end
plot(f_plot,x)
陆羽樊 当前离线   回复时引用此帖