MATLAB爱好者论坛-LabFans.com

MATLAB爱好者论坛-LabFans.com (https://www.labfans.com/bbs/index.php)
-   MATLAB论坛 (https://www.labfans.com/bbs/forumdisplay.php?f=6)
-   -   【求助】请帮忙解决一道有关m-file的函数画图题 (https://www.labfans.com/bbs/showthread.php?t=984)

陆羽樊 2007-12-23 19:28

【求助】请帮忙解决一道有关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)

elunxu 2007-12-24 08:59

x for 0<=x<=6h中h是否理解为100?

function [f]=f(x)
k1=45000*(1+3)
k2=8100*(1+4)
a=1+0.01*1
b=1.5+0.01*3
x = 0:0.01:600
f=k1*x.^a+k2*x.^b
plot(x,f)

陆羽樊 2007-12-25 21:50

sorry~我忘记把h给出来了,但是h是固定值,没什么影响的,谢谢帮忙!!!


所有时间均为北京时间。现在的时间是 09:46

Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.