全部版块 我的主页
论坛 计量经济学与统计论坛 五区 计量经济学与统计软件 统计软件培训班VIP答疑区
1433 1
2010-07-26
我刚开始学matlab,需要要找到MAX方程最大时wbar的大小,并且看lamda和alfa变动对wbar的影响。具体的code如下(ufunc 和 vfunc 是两个function,在另外两个m file里):p=0.025;
theta=0.2;
tow=0.3;
w=200;
b=0.5;
step=0.02;
wbar=0:step:w;
nwbar = w/step+1;
matrix = zeros(21,41);
matrixw = zeros(21,41);
for alfa=0:0.05:1
    for lamda =0:0.1:4
MAX=(1-p)*(ufunc(w-tow*wbar,b)+vfunc(lamda,ufunc(w-tow*wbar,b)-ufunc((1-tow*alfa)*w,b)))+...
p*(ufunc((1-tow-tow*theta)*w+tow*theta*wbar,b)+vfunc(lamda,ufunc((1-tow-tow*theta)*w+tow*theta*wbar,b)-ufunc((1-tow*alfa)*w,b)));
m=uint8(alfa/0.05+1);
n=uint8(lamda/0.1+1);
mm=max(MAX);
matrix(m,n)=mm;
ind = find(MAX==mm);
ind=ind(length(ind));
matrixw(m,n)=step*(ind-1);
    end
end


请问是黑体的部分出错了吗?应该怎么改呢?
谢谢!
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

全部回复
2011-5-26 14:21:34
你在解一个Ramsey Model。但这个问题暂时无法回答你。原因:
第一,你只告诉我出错,连Matlab出错提示都没有告诉我
第二,现在我无法重复。没有ufun和vfun,我跑不了这个程序。

你可以把ufun和vfun贴出来,我再看看。

PS:我一般很少来这个版,你贴出来后给我发给论坛短信。
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群