Question

How to change line width of matlab legend without changing the other legend options?

I am trying to change the line width of a legend. I made it but in doing so I also changed the number of columns of my legend. Y...

23 days ago | 1 answer | 0

Question

How to use "while loop" in this case?

I would like to write a loop that says: "when the number of lags is smaller than the sample size stop it". This is what I trie...

1 month ago | 2 answers | 0

Question

How to insert a unique legend with subplot?

I have the following plot: y1 = [2,2,2,2]; y2 = [2.15, 2.115, 2.08, 2.07]; y3 = [0.08532, 0.071189, 0.05391, 0.06123]; y11...

2 months ago | 1 answer | 0

Question

Why saving a figure in pdf makes a dot much bigger than it is?

I am plotting the following figure: y1 = [0.2, 0.3, 0.4, 0.25, 0.2]; y2 = [0.1, 0.15, 0.18, 0, 15]; x = 1:numel(y1); % ...

2 months ago | 1 answer | 1

Question

How to move forward the shaded area in MATLAB plot?

I need to plot a graph where the first line is from, say, 2006-2008, and the second one from 2008-2009. The latter one has conf...

3 months ago | 1 answer | 0

Question

How to loop over a range of values?

I want to store some result from a function I built. These results are 7x1 for n iterations. How can I store values for 1:7, 8:1...

3 months ago | 1 answer | 0

Question

Error using xlsread.

I was running a rather big loop when this error propped up: Error using xlsread (line xxx) Invoke Error, Dispatch Exception: ...

4 months ago | 0 answers | 0

Question

How to turn character cells into double in MATLAB?

I have the following cell array: load 'qq.mat' blocks %100×1 cell array % {'mpta'} % {'mpta'} % {'mpta'} ...

4 months ago | 1 answer | 0

Question

How would you automate this code?

I have the following situation: d = [3 39 54 53 6]; n = 103; What I would like to do is to have a code wher...

4 months ago | 1 answer | 0

Question

How to use "if statements" when "ismember" is based on multiple conditions?

I have two vectors: indexM = csvread('indexM.csv'); %228 obs indexI = csvread('indexI.csv'); %199 obs indexM is a vector wher...

4 months ago | 1 answer | 0

Question

How to use 'if else' in this case?

I have the following variance-covariance matrix which is not positive definite: x = [183.5310 -0.4098 8.0035 -0.0333 ...

6 months ago | 1 answer | 0

Question

How to plot two lines with different scales in MATLAB?

I have attached the dataset I have y = readtable('t.csv'); The dataset has 4 columns: ignoring the first one, the second one i...

7 months ago | 1 answer | 0

Question

How to select a column on basis of some conditions on the rows?

I have a situation where I have a 6x100 matrix like the one below: x = randn(6,100) What I would like to do is to write a ...

7 months ago | 1 answer | 0

Question

How to plot a legend with multiple confidence intervals?

I have a plot with a line and 2 confidence intervals (90% and 68%). So, 5 lines in total. I would like to display only the legen...

7 months ago | 1 answer | 0

Question

How to subset the ylables to be displayed only on certain rows?

I have 24 series to plot but I would like to have the y-label displayed only on the rows 1,7,13,19. I tried this solution but i...

8 months ago | 1 answer | 0

Question

How to use if-else in this scenario?

I have a vector of numbers. What I would like to do is to change the composition of this vector depending on which function I am...

8 months ago | 1 answer | 0

Question

How to reshape the x-axis in this case?

I have a chart (attached) that starts the sample in 2008 despite the actual data starts in 2009-01. I would like to understand w...

8 months ago | 1 answer | 0

Question

How to use if statements and for loop to plot the following series?

I am trying to plot the following series in a subplot (6X2). The idea is to have the first column in blue, while the second in r...

9 months ago | 1 answer | 0

Question

How to use if/else on the basis of rows?

I have a pre-specified model that runs smoothly. The problem is that I have two datasets for the same model. The two datasets ch...

10 months ago | 1 answer | 0

Question

Dashed confidence intervals and xlabel

Today is my "plot day". I am trying to fit subplot with shaded confidence intervals (find the dataset attached). Besides, I have...

1 year ago | 1 answer | 0

Question

How to plot two different styles of confidence intervals in looped subplots?

I have a plot with 6 variables and 5 subplot. In one case, the third variable, I want it to display two lines in one graph. So f...

1 year ago | 1 answer | 0

Question

How to plot two lines in a looped subplot in matlab?

I plotted 5 graphs with a loop in MATLAB. Now, I want to add a further line only to the third plot. However, when I try to do it...

1 year ago | 1 answer | 0

Question

How to loop the number of lags in a VAR?

I am fitting a simple var model. What I would like to do is basically choosing the optimal number of lags. I can do it in two wa...

1 year ago | 0 answers | 0

Question

Problems with double looping

I am trying to implement this double loop. There is lot of material online on double looping in matlab but I don't manage to mak...

1 year ago | 1 answer | 0

Question

Problems in using "dwtest"

I have a simple Tx3 matrix of residuals. I want to apply to it the dwtest to test for autocorrellation (I also used autocorr but...

1 year ago | 1 answer | 0

Question

How to set the IRFs for one variable equal to 0?

I have a VAR model with 4 variables. I ran my VAR in the baseline scenario. What I want to do now is a simulation exercise where...

1 year ago | 0 answers | 0

Question

How to loop different y-labels in different plots?

I want to display 4 graphs of Impulse Response Functions (IRFs) with their confidence intervals. I would like the labels to appe...

1 year ago | 1 answer | 0

Question

How to pass the same function to different columns?

I would like to pass the same function to all the columns of an object. I tried this code but it doesn't work for j = 1:3 ...

1 year ago | 1 answer | 0

Question

How to estimate the optimal number of lags in VAR models from the data?

I am fitting a VAR model and I was wondering which commands (if any) in MATLAB calculates the optimal number of lags given the s...

1 year ago | 1 answer | 0

Question

How to reproduce this table in MATLAB?

I would like to reproduce this table in MATLAB (including title and note). Unfortunately, the analysis I carried out doesn't hav...

1 year ago | 0 answers | 0