| 查看: 540 | 回复: 2 | ||
塞纳河的左岸金虫 (著名写手)
|
[求助]
matlab程序有误,望不吝赐教,十分感谢,matlab真的是零基础
|
|
用三次样条函数 去模拟汽车门的曲线,车门曲线的型值点数据如下 0 1 2 3 4 5 6 7 8 9 10 2.51 3.30 4.04 4.70 5.22 5.54 5.78 5.40 5.57 5.70 5.80 >> x=0:1:10; y=[2.51 3.30 4.04 4.70 5.22 5.54 5.78 5.40 5.57 5.70 5.80]; dy0=0.8; dy10=0.2; xx=0:.01:10; hh=h(x); uu=u(hh); dd=d(hh,y); d0=6.0/hh(1)*((y(2)-y(1))/hh(1)-dy0); d10=6.0/hh(10)*(dy10-(y(11)-y(10))/hh(10)); a=[uu 1]; b=[2 2 2 2 2 2 2 2 2 2 2]; c=[1 1-uu]; d=[d0 dd d10]; f1=m(a,b,c,d,x); for i=1:1001 yy(i)=s(x,y,hh,f1,xx(i)); end plot(x,y,'bo-',xx,yy,'r') ??? Undefined function or method 'h' for input arguments of type 'double'. >> function hh=h(x) n=length(x)-1; for i=1:n hh(i)=x(i+1)-x(i); end ??? function hh=h(x) | Error: Function definitions are not permitted in this context. >> function uu=u(x) n=length(x)-1; for i=1:n uu(i)=x(i)/(x(i)+x(i+1)); end ??? function uu=u(x) | Error: Function definitions are not permitted in this context. >> function dd=d(hh,y) n=length(hh)-1; for i=1:n dd(i)=6.0/(hh(i)+hh(i+1))*((y(i+2)-y(i+1))/hh(i+1)-(y(i+1)-y(i))/hh(i)); end ??? function dd=d(hh,y) | Error: Function definitions are not permitted in this context. >> function f=m(a,b,c,d,x) n=length(x)-1; for i=2:n r=a(i-1)/b(i-1); b(i)=b(i)-r*c(i-1); d(i)=d(i)-r*d(i-1); end d(n+1)=d(n+1)/b(n+1); for i=n:-1:1 d(i)=(d(i)-c(i)*d(i+1)/b(i+1))/b(i); end f=d; ??? function f=m(a,b,c,d,x) | Error: Function definitions are not permitted in this context. >> function an=s(x,y,h,f,x0) n=length(x)-1; for i=1:n if x0>=x(i)&x0<=x(i+1) an=f(i)*(x(i+1)-x0)^3/(6*h(i))+f(i+1)*(x0-x(i))^3/(6*h(i))+(y(i)-f(i)*h(i)^2/6)*(x(i+1)-x0)/h(i)+(y(i+1)-f(i+1)*h(i)^2/6)*(x0-x(i))/h(i); end end ??? function an=s(x,y,h,f,x0) | Error: Function definitions are not permitted in this context. 这个我真的不会,求指教啊 |
» 猜你喜欢
一个化合物的合成路线:CAS:367929-02-0 名称:8β-乙烯基雌二醇
已经有4人回复
太白金星有点烦
已经有3人回复
中国地质大学(北京)博士招生补录,数理学院材料科学与工程专业和材料与化工专业
已经有3人回复
河北省自然基金
已经有8人回复
收到国自然专家邀请后几年才会有本子送过来评
已经有3人回复
考博
已经有3人回复
有没有快的中文核心比较快录用的,纳米材料光催化
已经有4人回复
本人42,博士刚毕业,现在找不到工作,怎么办?:(
已经有21人回复
有人投过CCC中国控制会议吗?
已经有3人回复
3,4-二羟基苯乙酮如何纯化?
已经有5人回复
» 本主题相关价值贴推荐,对您同样有帮助:
matlab优化求解中遇到问题,望大神指点。。。
已经有7人回复
matlab结果中,太小的数不用科学计数法,让其显示为零(四舍五入),怎么办?
已经有10人回复
用Matlab生成一张类似魔方的图片,望各路大神指教!!!!!!!!
已经有3人回复
高手进来用matlab求解常微分方程,十分感谢!
已经有17人回复


2楼2014-11-24 12:40:08
塞纳河的左岸
金虫 (著名写手)
- 应助: 4 (幼儿园)
- 金币: 2426.1
- 散金: 10
- 红花: 3
- 帖子: 1179
- 在线: 234.6小时
- 虫号: 1388927
- 注册: 2011-09-03
- 性别: GG
- 专业: 电化学

3楼2014-11-24 14:23:25












回复此楼