楼主: lyaochiminh
1390 7

[问答] matlab code question [推广有奖]

  • 0关注
  • 1粉丝

硕士生

43%

还不是VIP/贵宾

-

威望
0
论坛币
10 个
通用积分
0.0002
学术水平
16 点
热心指数
14 点
信用等级
8 点
经验
2196 点
帖子
85
精华
0
在线时间
239 小时
注册时间
2008-12-4
最后登录
2016-7-3

楼主
lyaochiminh 发表于 2013-6-5 17:03:57 |AI写论文
20论坛币
近期在写作一篇paper, 需用MatLab一组复杂的nonlinear equations。
example.gif
关于以上的方程组,如何在matlab里编程来做出x关于t(the graph of x or y in terms of t)的函数图象呢?
我知道当t等于一个特定的值,如1时,可以用fsolve来求方程组的根。当然我可以让t取很多值来,求很多次根来做出图象。但想知道有没有简便的方法让matlab 直接plot出我想要的图。
希望熟悉matlab的朋友们可以帮我写点code来解决这个问题。
本文来自: 人大经济论坛 Matlab及其他计量软件专版 版,详细出处参考: https://bbs.pinggu.org/forum.php?mod=viewthread&tid=2461115&page=1&from^^uid=804732

关键词:matlab code question MATLAB atlab Quest question fromuid matlab terms
I'm a master student majoring in economics at the University of Tokyo, and my research interests focus on Macroeconomics, monetary policy. Striking a balance between math skills and keen interest in

沙发
whj0451 发表于 2013-6-6 15:55:04
看看

藤椅
danielruc91 在职认证  发表于 2013-6-6 19:06:11
这个方程其实不难,把y看成参数。对y赋值,从第一个式子解出x,再从第二个式子解出t。。。plot(x,t)。。
这样做之所以可行是因为方程比较简单,很容易解出来,所以在效率上比fsolve函数高一些。

板凳
danielruc91 在职认证  发表于 2013-6-6 19:08:22
具体程序:
for y=ymin:0.1:ymax
    x=sqrt(1-exp(y));
    t=x+y.^2;
end
plot(x,t);  %或者: plot(t,x);

报纸
lyaochiminh 发表于 2013-6-6 22:17:32
danielruc91 发表于 2013-6-6 19:08
具体程序:
for y=ymin:0.1:ymax
    x=sqrt(1-exp(y));
谢谢你的回答。但距离我想要的东西还是相差很远。x,y是endogenous variables, t是exogenous variable.想知道的是x或y与t的关系。这个方程组是一个简单的例子,我想解决的方程组比这复杂很多。
I'm a master student majoring in economics at the University of Tokyo, and my research interests focus on Macroeconomics, monetary policy. Striking a balance between math skills and keen interest in

地板
danielruc91 在职认证  发表于 2013-6-7 16:15:39
lyaochiminh 发表于 2013-6-6 22:17
谢谢你的回答。但距离我想要的东西还是相差很远。x,y是endogenous variables, t是exogenous variable.想 ...
能给个真实的方程看看吗?
另外,关于内生或者外生变量,那是出于经济学上的考虑,数学上其实没有区别。。就是可能需要排一下序,然后再画图。。

7
danielruc91 在职认证  发表于 2013-6-7 16:16:47
lyaochiminh 发表于 2013-6-6 22:17
谢谢你的回答。但距离我想要的东西还是相差很远。x,y是endogenous variables, t是exogenous variable.想 ...
我是指如果你想看x或y关于t的关系,那么就应该对t排序再画图。。。

8
lyaochiminh 发表于 2013-6-7 17:12:15
danielruc91 发表于 2013-6-7 16:16
我是指如果你想看x或y关于t的关系,那么就应该对t排序再画图。。。
boring.jpg
实际要计算的如以上方程组,其他变量关于某个变量的图象,因为准备投稿到英文期刊,没有把所有的贴出来。跟其他的同学讨论研究后,基本解决了问题,solve语句来解决roots,然后用for语句来实现的。你给的code显得你的matlab水平还处于初级水平。thank,good luck。
I'm a master student majoring in economics at the University of Tokyo, and my research interests focus on Macroeconomics, monetary policy. Striking a balance between math skills and keen interest in

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2026-1-2 23:57