当前位置:网站首页>线性规划例题 投资的收益与风险
线性规划例题 投资的收益与风险
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')
边栏推荐
- QWebEngineView崩溃及替代方案
- Seven charts, learn to do valuable business analysis
- 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
- 寒门再出贵子:江西穷县考出了省状元,做对了什么?
- Nexus簡介及小白使用IDEA打包上傳到Nexus3私服詳細教程
- Understand one article: four types of data index system
- Jiuxian's IPO was terminated: Sequoia and Dongfang Fuhai were shareholders who had planned to raise 1billion yuan
- 易语言abcd排序
- 人生的开始
- js删除字符串中的子串
猜你喜欢
寒门再出贵子:江西穷县考出了省状元,做对了什么?
Atcoder beginer contest 169 (B, C, D unique decomposition, e mathematical analysis f (DP))
深度之眼(二)——矩阵及其基本运算
TCP拥塞控制详解 | 2. 背景
剑指 Offer 24. 反转链表
Easy language ABCD sort
【Leetcode】14. Longest Common Prefix
[leetcode] 14. Préfixe public le plus long
关于我
宝宝巴士创业板IPO被终止:曾拟募资18亿 唐光宇控制47%股权
随机推荐
博客主题 “Text“ 夏日清新特别版
寒门再出贵子:江西穷县考出了省状元,做对了什么?
LSF basic command
深度之眼(二)——矩阵及其基本运算
871. Minimum refueling times
Soul, a social meta universe platform, rushed to Hong Kong stocks: Tencent is a shareholder with an annual revenue of 1.28 billion
Use of openpose
Just a coincidence? The mysterious technology of apple ios16 is even consistent with the products of Chinese enterprises five years ago!
Understand one article: four types of data index system
2、 Expansion of mock platform
【Leetcode】14. 最长公共前缀
Detailed explanation of @accessories annotation of Lombok plug-in
一年頂十年
Learning Weekly - total issue 60 - 25th week of 2022
Sword finger offer 25 Merge two sorted linked lists
Believe in yourself and finish the JVM interview this time
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
linux安装postgresql + patroni 集群问题
visibilitychange – 指定标签页可见时,刷新页面数据
What if the default browser cannot be set?