当前位置:网站首页>线性规划例题 投资的收益与风险
线性规划例题 投资的收益与风险
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')
边栏推荐
- 剑指 Offer 22. 链表中倒数第k个节点
- LeetCode:1380. Lucky number in matrix -- simple
- Timing / counter of 32 and 51 single chip microcomputer
- [fluent] dart data type map type (create map set | initialize map set | traverse map set)
- P6774 [NOI2020] 时代的眼泪(分块)
- Qwebengineview crash and alternatives
- ThreadLocal
- 【Leetcode】13. 罗马数字转整数
- QStyle实现自绘界面项目实战(二)
- C语言自定义函数的方法
猜你喜欢

寒门再出贵子:江西穷县考出了省状元,做对了什么?

A case study of college entrance examination prediction based on multivariate time series

【Leetcode】14. 最长公共前缀

智能垃圾桶(五)——点亮OLED
![[error record] error -32000 received from application: there are no running service protocol](/img/6c/66099650de46cac88b805e6cfb90b9.jpg)
[error record] error -32000 received from application: there are no running service protocol

相信自己,这次一把搞定JVM面试

几行代码搞定RPC服务注册和发现

剑指 Offer 22. 链表中倒数第k个节点

酒仙网IPO被终止:曾拟募资10亿 红杉与东方富海是股东

PhD battle-11 preview | review and prospect backdoor attack and defense of neural network
随机推荐
MOSFET器件手册关键参数解读
智能垃圾桶(五)——点亮OLED
Understand one article: four types of data index system
Weili holdings listed on the Hong Kong Stock Exchange: with a market value of HK $500million, it contributed an IPO to Hubei
JS delete substring in string
What is the difference between JSP and servlet?
Timing / counter of 32 and 51 single chip microcomputer
js删除字符串中的子串
What if the default browser cannot be set?
Leetcode question brushing record | 933_ Recent requests
几行代码搞定RPC服务注册和发现
IP address translation address segment
What will you do after digital IC Verification?
Goodbye, shucang. Alibaba's data Lake construction strategy is really awesome!
电脑自带软件使图片底色变为透明(抠图白底)
人生的开始
Sword finger offer 22 The penultimate node in the linked list
什么是敏捷开发流程
ThreadLocal
Use the API port of the bridge of knowledge and action to provide resources for partners to access