当前位置:网站首页>线性规划例题 投资的收益与风险
线性规划例题 投资的收益与风险
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')
边栏推荐
- What will you do after digital IC Verification?
- 2020 "Lenovo Cup" National College programming online Invitational Competition and the third Shanghai University of technology programming competition (a sign in, B sign in, C sign in, D thinking +mst
- How to transfer business data with BorgWarner through EDI?
- LeetCode:1380. Lucky number in matrix -- simple
- The beginning of life
- traceroute命令讲解
- 【Leetcode】14. 最長公共前綴
- 亚马逊云科技 Community Builder 申请窗口开启
- What is the difference between JSP and servlet?
- Sword finger offer 27 Image of binary tree
猜你喜欢
【Leetcode】14. 最长公共前缀
Just a coincidence? The mysterious technology of apple ios16 is even consistent with the products of Chinese enterprises five years ago!
一文看懂:数据指标体系的4大类型
871. 最低加油次数
你想要的宏基因组-微生物组知识全在这(2022.7)
QWebEngineView崩溃及替代方案
畅玩集团冲刺港股:年营收2.89亿 刘辉有53.46%投票权
配置基于接口的ARP表项限制和端口安全(限制用户私自接入傻瓜交换机或非法主机接入)
寒门再出贵子:江西穷县考出了省状元,做对了什么?
LeetCode:1380. Lucky number in matrix -- simple
随机推荐
How openharmony starts FA of remote devices
关于我
Baobab's gem IPO was terminated: Tang Guangyu once planned to raise 1.8 billion to control 47% of the equity
TCP congestion control details | 2 background
Shutter: action feedback
綠竹生物沖刺港股:年期內虧損超5億 泰格醫藥與北京亦莊是股東
&lt; IV & gt; H264 decode output YUV file
traceroute命令讲解
Does digicert SSL certificate support Chinese domain name application?
移动应用性能工具探索之路
Timing / counter of 32 and 51 single chip microcomputer
福元医药上交所上市:市值105亿 胡柏藩身价超40亿
Linux Installation PostgreSQL + Patroni cluster problem
一年顶十年
什么是敏捷开发流程
The beginning of life
OpenPose的使用
Tech Talk 活动预告 | 基于Amazon KVS打造智能视觉产品
二、mock平台的扩展
一年頂十年