Answered

Customed distance function Haversine

You need to re-work your haversine function, as per the requirements for distance functions for pdist2. Apparently, the first a...

Customed distance function Haversine

You need to re-work your haversine function, as per the requirements for distance functions for pdist2. Apparently, the first a...

42 minutos ago | 0

Answered

Verifying an Vector composition

There is probably an easier approach, but I think this works. The result of this expression is 1 if a1<a2<a3<a4<a5, or 0 otherw...

Verifying an Vector composition

There is probably an easier approach, but I think this works. The result of this expression is 1 if a1<a2<a3<a4<a5, or 0 otherw...

1 día ago | 0

Answered

how can I sweep a triangle area using two loops

No need for loops. The tests are built in to the inpolygon function when you provide matrices as input. Assuming you want to f...

how can I sweep a triangle area using two loops

No need for loops. The tests are built in to the inpolygon function when you provide matrices as input. Assuming you want to f...

1 día ago | 0

Answered

HOW TO FILTER AN HOUR DATA FROM ARRAY OF DAILY,MONTHLY AND YEAR DATA

T = readtable('https://www.mathworks.com/matlabcentral/answers/uploaded_files/658625/SAMPLE%20DATA.xlsx'); % convert numeric ...

HOW TO FILTER AN HOUR DATA FROM ARRAY OF DAILY,MONTHLY AND YEAR DATA

T = readtable('https://www.mathworks.com/matlabcentral/answers/uploaded_files/658625/SAMPLE%20DATA.xlsx'); % convert numeric ...

2 días ago | 0

Answered

How to duplicate cell array by rows?

n = handles.times; % your integer value newSequence = repmat(sequence, 1, n);

How to duplicate cell array by rows?

n = handles.times; % your integer value newSequence = repmat(sequence, 1, n);

2 días ago | 0

| accepted

Answered

integral of a matrix

You note: I want to take the integral of an exponetial of a matrix But, exp(-M.*t)*Dmat; is a vector, not a matrix. Tr...

integral of a matrix

You note: I want to take the integral of an exponetial of a matrix But, exp(-M.*t)*Dmat; is a vector, not a matrix. Tr...

2 días ago | 0

Answered

Help rewritting textfiles in a certain way

This can probably be streamlined, but I think it achieves what you are looking for: % read the test data into a 1x1 cell and co...

Help rewritting textfiles in a certain way

This can probably be streamlined, but I think it achieves what you are looking for: % read the test data into a 1x1 cell and co...

2 días ago | 1

| accepted

Answered

How to get row and column from a vector size

Assuming the vector length being a prime number (as noted by @the cyclist) is just one possible case of many, then the following...

How to get row and column from a vector size

Assuming the vector length being a prime number (as noted by @the cyclist) is just one possible case of many, then the following...

3 días ago | 0

| accepted

Answered

How to plot based on the shortest vector?

So, the approach I think you are willing to take is just to ignore the few extra elements that are in the longer of the two vect...

How to plot based on the shortest vector?

So, the approach I think you are willing to take is just to ignore the few extra elements that are in the longer of the two vect...

3 días ago | 1

Answered

Best equation for Curve Fitting

How about r = .9999? Linear model Poly9: f(x) = p1*x^9 + p2*x^8 + p3*x^7 + p4*x^6 + p5*x^5 + p6*x^4...

Best equation for Curve Fitting

How about r = .9999? Linear model Poly9: f(x) = p1*x^9 + p2*x^8 + p3*x^7 + p4*x^6 + p5*x^5 + p6*x^4...

3 días ago | 0

Answered

How can a 4 element array index pull stored string values?

I think this is more or less what you are after. The output is generated both as a cell array and as a string vector. % create...

How can a 4 element array index pull stored string values?

I think this is more or less what you are after. The output is generated both as a cell array and as a string vector. % create...

3 días ago | 1

| accepted

Answered

Using System.DateTime in a Timetable

This converts the System.DateTime variable returned by netTime to a datetime variable, which can then be used with timetable: t...

Using System.DateTime in a Timetable

This converts the System.DateTime variable returned by netTime to a datetime variable, which can then be used with timetable: t...

3 días ago | 0

Answered

Change color of x axis and y axis barplot

I think this achieves what you are after. Note that plotyy is "not recommended". a = [rand(3,1)*100, zeros(3,1)]; b = [zeros(...

Change color of x axis and y axis barplot

I think this achieves what you are after. Note that plotyy is "not recommended". a = [rand(3,1)*100, zeros(3,1)]; b = [zeros(...

4 días ago | 0

| accepted

Answered

Scatter Plot Legend Issue With Assignment

You only need to call the scatter function once. Re-organize your data, combining the values into a matrix. Then, you'll get ...

Scatter Plot Legend Issue With Assignment

You only need to call the scatter function once. Re-organize your data, combining the values into a matrix. Then, you'll get ...

4 días ago | 1

Answered

Do error bars affect confidence intervals?

You note: when I use the errorbar function in the code of the fit, it doesn't seem to change the confidence intervals The ...

Do error bars affect confidence intervals?

You note: when I use the errorbar function in the code of the fit, it doesn't seem to change the confidence intervals The ...

4 días ago | 0

Answered

Help with plotting data in a mat file

I think the error might be in how you are verifying your script. I ran your script and generated the plots. Here is what I see ...

Help with plotting data in a mat file

I think the error might be in how you are verifying your script. I ran your script and generated the plots. Here is what I see ...

4 días ago | 0

Answered

Changing prime numbers in a matrix

M = randi([1 50],100); M(isprime(M)) = 1415;

Changing prime numbers in a matrix

M = randi([1 50],100); M(isprime(M)) = 1415;

5 días ago | 0

Answered

How to extract value from matrix in a cell array?

>> cell{1}(1,3) ans = 5

How to extract value from matrix in a cell array?

>> cell{1}(1,3) ans = 5

5 días ago | 0

| accepted

Answered

Using a for loop to print function values

Seems you are confusing Vs with V. And what is VL-0.6 in your question? Try this... (outputs a vector of values) V = rand(1,1...

Using a for loop to print function values

Seems you are confusing Vs with V. And what is VL-0.6 in your question? Try this... (outputs a vector of values) V = rand(1,1...

6 días ago | 0

| accepted

Answered

How to find area under graph between two points ?

Assuming you want the area under the curve between two values of x (your "specific points"), here's what I put together using so...

How to find area under graph between two points ?

Assuming you want the area under the curve between two values of x (your "specific points"), here's what I put together using so...

6 días ago | 0

Answered

How to extract data from an array?

t(700:1900) P(700:1900) Really, this is pretty basic stuff. I suggest you review Accessing Array Elements.

How to extract data from an array?

t(700:1900) P(700:1900) Really, this is pretty basic stuff. I suggest you review Accessing Array Elements.

6 días ago | 0

| accepted

Answered

Why is logical array fasle?

The result is false because k1 DOES NOT EQUAL g Note that both k1 and g are scalars, not vectors. Therefore, the result of k1=...

Why is logical array fasle?

The result is false because k1 DOES NOT EQUAL g Note that both k1 and g are scalars, not vectors. Therefore, the result of k1=...

6 días ago | 0

Answered

How to remove space between grouped bars in a bar graph?

Here's an approach that might be useful. What if you ungroup the data first? There will be no space between the groups, because...

How to remove space between grouped bars in a bar graph?

Here's an approach that might be useful. What if you ungroup the data first? There will be no space between the groups, because...

6 días ago | 0

Answered

saving files in a loop with different names

for k=1:20 ... filename = sprintf('info%d.dat', k); writematrix(M, filename); % data in M ... end

saving files in a loop with different names

for k=1:20 ... filename = sprintf('info%d.dat', k); writematrix(M, filename); % data in M ... end

6 días ago | 0

Answered

Can I do a repeated-measures three-way ANOVA with 2 within and one between variable?

Yes. Here's an example script I used recently for such a design. The within-subjects factors are Layout (2 levels) and Trial (...

Can I do a repeated-measures three-way ANOVA with 2 within and one between variable?

Yes. Here's an example script I used recently for such a design. The within-subjects factors are Layout (2 levels) and Trial (...

6 días ago | 0

| accepted

Answered

Creating a piecewise function

A few bugs in your code. Here's the fix (although there are easier ways to do this): x = 0 : 0.5 : 4; for k = 1 : length(x) ...

Creating a piecewise function

A few bugs in your code. Here's the fix (although there are easier ways to do this): x = 0 : 0.5 : 4; for k = 1 : length(x) ...

7 días ago | 1

Answered

put labels inside colorbar

Just add tick labels to the colorbar: plot(rand(1,5)); h = colorbar('northoutside'); h.TickLabels = { -.4 -.3 -.2 -.1 0 .1 .2...

put labels inside colorbar

Just add tick labels to the colorbar: plot(rand(1,5)); h = colorbar('northoutside'); h.TickLabels = { -.4 -.3 -.2 -.1 0 .1 .2...

7 días ago | 0

Answered

plot values of same index from two vectors

Here's what I put together. It looks a bit crazy because the data are just random numbers. But, I think it achieves more or le...

plot values of same index from two vectors

Here's what I put together. It looks a bit crazy because the data are just random numbers. But, I think it achieves more or le...

7 días ago | 0

| accepted

Answered

New point calculation - for loop

No need for a loop: % arbitrary point for beginning (perhaps longitude) x1 = randi([1 1000],1); y1 = randi([1 1000],1); % ...

New point calculation - for loop

No need for a loop: % arbitrary point for beginning (perhaps longitude) x1 = randi([1 1000],1); y1 = randi([1 1000],1); % ...

7 días ago | 0

Answered

Samples in generating a given signal

There are 128 values in the vector [0:127]: 0, 1, 2, 3, ... 126, 127 If the vector was defined using the term 128, as in yo...

Samples in generating a given signal

There are 128 values in the vector [0:127]: 0, 1, 2, 3, ... 126, 127 If the vector was defined using the term 128, as in yo...

7 días ago | 0