当前位置:网站首页>线性规划例题 投资的收益与风险
线性规划例题 投资的收益与风险
2022-07-02 14:48:00 【__Rain】
、







得到拐点的 a a a 值运行一下求对应的变量值即可
clear;clc;
a=0;%投资风险
hold on
while a<0.05
c=[0.05 0.27 0.19 0.185 0.185];%目标函数的系数矩阵
A=[zeros(4,1),diag([0.025 0.015 0.055 0.026])];%不等式的系数矩阵
%把1*4的列向量和4*4的矩阵拼接起来,对角线为diag中的元素
b=a*ones(1,4);%生成全1的列向量,所有元素乘以a
%b是行向量还是列向量不影响结果
Aeq=[1 1.01 1.02 1.045 1.065];%等式左端中的系数矩阵
beq=1;%等式右端的值
lb=zeros(1,5);%变量x的下界
%lb是行向量还是列向量不影响结果
[x, Q]=linprog(-c,A,b,Aeq,beq,lb);%求最大值记得取-c
plot(a,-Q,'*r');% -Q为最终值
a=a+0.001;
end
xlabel('a'),ylabel('Q')
边栏推荐
- Sword finger offer 22 The penultimate node in the linked list
- 【Leetcode】13. 罗马数字转整数
- executescalar mysql_ExecuteScalar()
- QStyle实现自绘界面项目实战(二)
- A few lines of code to complete RPC service registration and discovery
- 深度之眼(三)——矩阵的行列式
- Sword finger offer 26 Substructure of tree
- The beginning of life
- ssb门限_SSB调制「建议收藏」
- 超卓航科上市:募资9亿市值超60亿 成襄阳首家科创板企业
猜你喜欢

TCP congestion control details | 2 background

Understand one article: four types of data index system

GeoServer:发布PostGIS数据源

智能垃圾桶(五)——点亮OLED

Sword finger offer 25 Merge two sorted linked lists

剑指 Offer 24. 反转链表

Ap和F107数据来源及处理

The poor family once again gave birth to a noble son: Jiangxi poor county got the provincial number one, what did you do right?

How to transfer business data with BorgWarner through EDI?

【Leetcode】14. Longest Common Prefix
随机推荐
The impact of telecommuting on all aspects of our experience | community essay solicitation
Deep learning image data automatic annotation [easy to understand]
IP address translation address segment
In MySQL and Oracle, the boundary and range of between and precautions when querying the date
【Leetcode】14. Longest Common Prefix
What if the default browser cannot be set?
Win10系统使用pip安装juypter notebook过程记录(安装在系统盘以外的盘)
ETH数据集下载及相关问题
Nexus簡介及小白使用IDEA打包上傳到Nexus3私服詳細教程
智能垃圾桶(五)——点亮OLED
Method of C language self defining function
电脑自带软件使图片底色变为透明(抠图白底)
剑指 Offer 26. 树的子结构
AP and F107 data sources and processing
A case study of college entrance examination prediction based on multivariate time series
Notice on holding a salon for young editors of scientific and Technological Journals -- the abilities and promotion strategies that young editors should have in the new era
Goodbye, shucang. Alibaba's data Lake construction strategy is really awesome!
Jiuxian's IPO was terminated: Sequoia and Dongfang Fuhai were shareholders who had planned to raise 1billion yuan
剑指 Offer 22. 链表中倒数第k个节点
visibilitychange – 指定标签页可见时,刷新页面数据