Problem with matrix function output (Q learning, Calvano et al. 2021)
조회 수: 1 (최근 30일)
이전 댓글 표시
Hello !
I'm currently working on the Q learning algorithm similar to the one presented in Calvano et al. 2021 (AER).
As a part of preliminary work, I want to produce a distribution table similar to the one I attached below.
The idea is simple. I have a function which gives prices and profits for 2 market makers depending on multiple parameters. More particularly, I want it to vary in alpha (2.0:0.1:4.0) and beta (0.04:0.001:0.06) and fix other parameters at the begining. Then, having a matrix of average values (my function 'fn' gives average prices and profits) and using imagesc(), it would be easy to obtain the desired results. The problem is that the code is not working.
Here is what I have at the moment :
beta0=0
n=10000
T=1000
[P,Profit]=fn(2.0:0.1:4.0,0.04:0.001:0.06,beta0,n,T); % I don't know how to index the profits depending on alpha and beta in order to have a clear matrix later.
Matr=append(Profit(:,1)); % Here I put Profit(:,1) because I'm verifying first the profits of the first market maker. But the 'append' function is clearly a wrong idea.
a=(2.0:0.1:4.0)
b=(0.04:0.001:0.06)
imagesc(b, a, Matr);
set(gca, 'YDir', 'normal');
xlabel('beta');
ylabel('alpha');
colorbar
I've already spent hours looking for an answer. It's the first time I use matlab which makes it difficult not only to optimize my code (to make it less time consuming) but also to make it work. I would be very greatful for any help. Thank you !!
댓글 수: 4
Walter Roberson
2021년 5월 14일
편집: Walter Roberson
2021년 5월 14일
Where does your code use alpha ?
Also your f1 function appears to be truncated.
채택된 답변
Sulaymon Eshkabilov
2021년 5월 14일
There are several inconsistencies in your code:
(1) You are calling the function file called fn. However, your function file is named f1.
(2) You are inputting too many inputs (five in total, viz. 2.0:0.1:4.0,0.04:0.001:0.06,beta0,n,T) in fn. However, you have assigned only four input variables, viz. alpha,beta,beta0,T
(3) Another crucial err is that you have not defined//calculated Profits().
If you post the missing parts of your scripts, additional help can be provided.
댓글 수: 2
Sulaymon Eshkabilov
2021년 5월 15일
There are still two more parameters are ill-defined or overlooked. They are n and M. "n" is never been used and M has only "0" values.
To append all the values of Profit, CELL array can be employed within the loop.
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!