在电子商务行业快速发展的时代背景下,农产品双渠道营销模式是供应商的最佳选择,但消费者对农产品绿色度的重视程度逐渐提升,而且零售商因其利润可能减少,对网上直销渠道充满敌意,导致绿色农产品网上直销渠道发展不尽人意。本文只考虑单一供应商和单一零售商组成的绿色农产品双渠道供应链系统,其中供应商占据市场主导地位,考虑农产品的绿色度对需求的影响,建立 Stackleberg 博弈模型,比较分析集中和分散决策下的供应链最优利润水平。
这个模型咋建?
syms r k a g
syms在matlab中的作用是定义符号变量,意思为创建符号变量r、k、a、g
The role of syms in matlab is to define symbolic variables, meaning to create symbolic variables r, k, a, g
k=0.667;a=0.7;g=1.7;
输入给变量的赋值
Input to variable assignment
d=0:0.01:1;
假设图形每隔0.01单位取一个点、可根据自己的需要设置
Assuming that the graph takes one point every 0.01 unit, you can set it according to your needs
Wml3=[ ];
设定一个空集合
Set an empty collection
Wml4=[ ];
再设定一个空集合,因为后面画两个函数的图形,所以设定两个空集合,拿来装运行后每个函数的值
Set an empty set again, because the graphs of two functions are drawn later, so set two empty sets to load and run the value of each function
for r=0:0.01:1
套用一个for循环函数,这里求r为自变量,r变化带给函数的变化趋势,所以假设r每隔0.01取一次值
Apply a for loop function, where r is the independent variable, and the change of r brings the change trend of the function, so suppose r takes a value every 0.01
Wml1=0.5*(-(kr(ag-1)-1)+(a+ak*(g-1)-1)kr);
输入函数1
Input function 1
Wml2=0.5*(a+ak(g-1)-kr(ag-1)+(a+ak*(g-1)-1)kr);
输入函数2
Input function 2
Wml3=[Wml3 Wml1];
将求得的函数1的值,装入刚刚设定的空集合Wml3
Put the obtained value of function 1 into the empty set Wml3 just set
Wml4=[Wml4 Wml2];
将求得的函数2的值,装入刚刚设定的空集合Wml4
Put the obtained value of function 2 into the empty set Wml4 just set
end
循环结束
End of loop
figure()
建立图形
Create graphics
plot(d,Wml3,'b-x',d,Wml4,'r-+')
用plot函数绘制两个二维图形,plot(X,Y,LineSpec)
Use the plot function to draw two two-dimensional graphics, plot (X, Y, LineSpec)
图形样式格式设置如下
The graphic style format is set as follows
xlabel('\lambda');
给x轴命名
Name the x-axis
\alpha,\beta,\gamma,\delta,\lambda,\phi就是实现希腊字母输出的
\alpha,\beta,\gamma,\delta,\lambda,\phi is the output of Greek letters
ylabel('w');
给y轴命名
Name the y-axis
legend('w_1^{ML}','w_2^{ML}')
插入图例,图形1叫什么,图形2叫什么
Insert a legend, what is figure 1 called, and what is figure 2 called
上下标的输入
Input of subscripts and subscripts
Matlab中上标用^(指数),下标用_(下划线)
Matlab uses ^ (index) for superscripts and _ (underscore) for subscripts
调用方式为:^{任意字符},_{任意字符}
The calling method is: ^{any character},_{any character}
gtext({'w_1^{ML}';'w_2^{ML}'})
可以看到图像窗口中将出现一条十字准线。在需要标注的地方点击鼠标,即可在图片上标记要标记的内容
You can see that a crosshair will appear in the image window. Click the mouse on the place that needs to be marked, you can mark the content to be marked on the picture
gtext('y= sin x','FontSize',14)可以更改字体大小*
*gtext('y= sin x','FontSize', 14)The font size can be changed
% hold off
hool on 和hold off的差别
hold on在当前坐标系中画了一幅图,再画另一幅图时,原来的图还在,与新图都能被看到
hold on draws a picture in the current coordinate system, and then draws another picture, the original picture is still there, and the new picture can be seen
hold off在当前坐标系中画了一幅图,再画另一幅图时,原来的图就看不到了,在轴上绘制的是新图
hold off draw a picture in the current coordinate system, and then draw another picture, the original picture is not visible, and the new picture is drawn on the axis
% pause