Answered
legend NumColumns not working in 2018a
It looks to me that the documentation states the change was in R2018b, not R2018a. As you can see, that code works fine here (R...

5 years ago | 0

| accepted

Answered
How to plot like the following figure?
I recommend looking at the MATLAB Plot Gallery, finding a figure that is close to what you need, and pulling the code from there...

5 years ago | 0

Answered
Transfering any point in PC space to original space
Borrowing the first few lines of code from my PCA tutorial ... rng 'default' M = 7; % Number of observations N = 5; % Number ...

5 years ago | 1

| accepted

Answered
How can I find the average of several lines whose datasets are different lengths?
One possible solution would be to interpolate (e.g. with spline function) using the interp1 function, to a common grid of points...

5 years ago | 0

Answered
Why do I receive "Index exceeds the number of array elements (1)" ?
m is a scalar -- the length of the vector x, plus one. You try to index into it as if it is a vector, for example in the expres...

5 years ago | 0

| accepted

Answered
Normalize unit vector to single didgit integers
Does the following do what you want? f = @(t) round(t/abs(min(t))); f([ 0.4 -0.4 0.8]) f([ 0.123 0.123 .5]) It gives a dif...

5 years ago | 0

Answered
VPA error Index exceeds number of array elements
I'm confused, because the code you posted runs fine: syms t P(t)= 30/(3+7*exp((-.03*t))) P(1960) vpa(P(1960)) Is it possibl...

5 years ago | 0

Answered
How can I solve this error?
When defining a function using that syntax, it has to appear inside a file, for example a text file with the name GRxx_P8_E1.m ...

5 years ago | 0

| accepted

Answered
How to plot binary matrix as dots?
M = magic(7); B = M > mean(M); colormap('gray') imagesc(B) axis square

5 years ago | 0

Answered
Interpolation of (multidimensional) array
So, this is a somewhat strange "interpolation" (and extrapolation) problem. It requires certain assumptions to leap from your da...

5 years ago | 0

| accepted

Answered
multiplication of empty 0X0 double and scalar (1X1)
One possible solution is to use a try-catch structure. The "try" block will be the code that is generally executed, but if that ...

5 years ago | 0

| accepted

Answered
operations on two different matrices
Suppose ... m = 3; n = 4; A = magic(m) B = magic(n) The first row of A is a 1x3 row vector, and the first row of B is a 1...

5 years ago | 0

Solved


The Piggy Bank Problem
Given a cylindrical piggy bank with radius g and height y, return the bank's volume. [ g is first input argument.] Bonus though...

5 years ago

Answered
How to find correlations between a vector and a 3D array and plot the correlations spatially?
Is it correct that the result will be a 120x120 array of correlations, where each entry is the correlation of the 50 isotope val...

5 years ago | 1

| accepted

Answered
How to randomly change element of matrix?
I'll illustrate for an nxn where n = 3, and repeat 2 times: % Set the random number generator seed, for repeatability here rng...

5 years ago | 1

| accepted

Answered
I want to remove the blank space between the first two bars and the last two bars. Can anyone help please?
Instead of using the dates in x1 to define the bar positions along the X axis, you could use h1=bar(M1); % instead of h1=bar(x1...

5 years ago | 0

| accepted

Answered
Matlab only calculates values for only certain inputs in a matrix.
Several thoughts: First When you write convof = 1/x you need to realize that x is a vector. I think you intended for i=1:10...

5 years ago | 0

Answered
stop execution of code to check results
One way would be to use the debugger, specifically a conditional breakpoint.

5 years ago | 0

Answered
How to know which distribution is BCa method form bootci assuming my data follows
I don't have a definitive answer, but looking inside the code of bootci.m (by using edit bootci), I see enough usage of norminv ...

5 years ago | 0

Answered
trying to put 2 numbers in the a single array repeated the same amount of times and get a sum that adds both of them up
There are several ways to do this in MATLAB. Take a look at the repmat and repelem functions. If you get the array defined corr...

5 years ago | 1

Answered
vpa Does Not Show the Required Number of Significant Digits
I'd have to spend more time to figure out the truly complete answer to this, but I'm confident that the reason is that the MATLA...

5 years ago | 1

Answered
Correlation coefficient between three column vectors
You should read the documentation, to determine whether a function does what you need. But I think you probably actually want c...

5 years ago | 1

Answered
Plotting 4D matrix in 2D space
You are using the plot command in a way that you wish it worked, without carefully understanding how the syntax actually works. ...

5 years ago | 0

Answered
How to correctly plot the error of a numerical algorithm ?
You can use the semilogy function instead of the plot function..

5 years ago | 0

| accepted

Answered
Search a date from a datetime to another with different length
The result of the operation A(i,1)==B(:,1) is a vector, as is the result of the other equality check you do. You can only use ...

5 years ago | 1

| accepted

Answered
how to adjust bar width (absolute value)?
I would point out that in one sense, your bars are the same width -- they both extend one unit (e.g. from 1.5 to 2.5). The reaso...

5 years ago | 0

| accepted

Answered
Arrow of a vector ( r, theta) from a point (x,y).
You can make an arrow on a plot using the annotation function, or you may want to use a quiver plot if you want the arrow to com...

5 years ago | 1

Answered
How to find all possible combinations between the numbers of two vectors where order does matter
I expect there is a more efficient way, but I think this will do what you want. a = [1 2 3 4]; b = [2 4]; c = unique([combv...

5 years ago | 0

| accepted

Answered
Why this code the given error?
CVX is a third-party MATLAB toolbox (i.e. not from MathWorks), that you need to install according to their instructions. You nee...

5 years ago | 0

| accepted

Answered
How can I read specific data from excel with multiple sheets?
My first choice for reading data from Excel is usually the readtable function. It has many options for pulling data from individ...

5 years ago | 1

| accepted

Load more