Why do I always get 0 when I calculate VaR with Matlab? 20

Updated on technology 2024-06-02
3 answers
  1. Anonymous users2024-02-11

    It depends on what kind of data your atkj is.

    If it's a row of data: it won't be 0 if you run it by your **

    atkj=:1

    atkj =

    daynum=length(atkj);

    portreturn=mean(atkj(1:daynum));

    portrisk=std(atkj(1:daynum));

    riskthreshold=[,portvalue=1;

    valueatrisk=portvrisk(portreturn,portrisk,riskthreshold,portvalue)% The last semicolon is removed, so that the result can be displayed in the command window, if the semicolon is not removed, you can see the value % of vauleatrisk in the workspace in the upper left corner

    valueatrisk =

    0 %% run result.

    If your data is not a row, but a two-dimensional matrix.

    atkj = rand(10)%10*10 size.

    atkj =

    portreturn=mean2(atkj);% to calculate the mean of ATKJ, you can't use mean, if you use mean, you can average it by column, and the dimension of the final portreturn is 1*10%%.

    portrisk=std2(atkj);In the same way as %std, std2 should be used to calculate the variance.

    riskthreshold=[,portvalue=1;

    valueatrisk=portvrisk(portreturn,portrisk,riskthreshold,portvalue)

    valueatrisk =

    0 %% run result.

  2. Anonymous users2024-02-10

    I don't really understand you either, but there is one thing: does your atkj have an assignment? Is there a program in front of you that you have missed?

  3. Anonymous users2024-02-09

    In MATLAB, a(i) =0 means:

    Determine if the ith element of array a is not equal to 0, if it is not equal to 0, the result is true, otherwise it is false.

    Analysis: a(i) represents the ith element in array a, and in MATLAB it means not, and = means not equal to (≠).

    The following is an example: 1. Open MATLAB and enter the sample array in the command window.

    a = -1:3

    2. Determine whether the first element of a is not equal to 0: >a(1) = 0

    Because the 1st element of a is equal to -1 and satisfies the condition that it is not equal to 0, the result is true and the result is displayed as 1

    3. Determine whether the second element of a is not equal to 0: >a(2) = 0

    Because the second element of a is equal to 0 and the condition that it is not equal to 0 is not satisfied, the result is false, and the result is displayed as 0

Related questions
13 answers2024-06-02

The motherboard battery is dead, there is no memory function, this is the same as some mobile phones, some mobile phone chips have memory function, even if the electric board is removed, shut down, and the time to turn on again is still accurate, just change the button battery, generally that's it, no problem

11 answers2024-06-02

1.Fully understand the current popular industries or professions in the society, such as the Internet industry, IT technology, new industry, chef, e-sports, auto repair, beauty, logistics, mold, etc., choose from these industries and professions with good development prospects and low competitive pressure, and then go to study and train; >>>More

7 answers2024-06-02

In the eyes of employers, it is one of the criteria to prove a student's learning ability, if not, when applying, there may be a little trouble. >>>More

4 answers2024-06-02

Generally speaking, the national computer proficiency certificate represents your computer operation ability, which is a recognized certificate of skill when you are looking for employment, and represents that your computer operation skills have reached a certain level. >>>More

9 answers2024-06-02

Calculate time with a sundial. But they are sundials created from the experience of observing celestial phenomena over a long period of time.