Answered

poisson random distributoin with zeros

If you have the Statistics and Machine Learning Toolbox, then BIG = 80000; SMALL = 1000; MEAN = 2400; idx = randsample...

poisson random distributoin with zeros

If you have the Statistics and Machine Learning Toolbox, then BIG = 80000; SMALL = 1000; MEAN = 2400; idx = randsample...

circa 11 ore ago | 0

Answered

Speadsheet with all the answers from my loop

output = zeros(n,1); for i=1:n output(i) = length(find(yy(1:numel(yy),1)==i)); end output That will still write the ful...

Speadsheet with all the answers from my loop

output = zeros(n,1); for i=1:n output(i) = length(find(yy(1:numel(yy),1)==i)); end output That will still write the ful...

1 giorno ago | 0

| accepted

Answered

How to make diagonal matrices from a single column

B = zeros(8,2); B(1:2:end,1) = A(1:2:end); B(2:2:end,2) = A(2:2:end);

How to make diagonal matrices from a single column

B = zeros(8,2); B(1:2:end,1) = A(1:2:end); B(2:2:end,2) = A(2:2:end);

1 giorno ago | 0

| accepted

Answered

How to specify a number to the specified position in the array？

There's probably not an built-in function that does just that, but it's easy to do it with basic array manipulations. Here is on...

How to specify a number to the specified position in the array？

There's probably not an built-in function that does just that, but it's easy to do it with basic array manipulations. Here is on...

2 giorni ago | 0

Answered

How to plot outliers from mean

There are three steps: Create an algorithm to define the outliers Identify the points that meet that definition Plot those po...

How to plot outliers from mean

There are three steps: Create an algorithm to define the outliers Identify the points that meet that definition Plot those po...

3 giorni ago | 0

| accepted

Answered

Function with euler not working properly

The images you posted don't show up for me, either. Your code ran for me, and yielded this figure: I think you might have wa...

Function with euler not working properly

The images you posted don't show up for me, either. Your code ran for me, and yielded this figure: I think you might have wa...

3 giorni ago | 0

| accepted

Answered

Comparing elements of a vector.

[g(:,2), idx] = unique(R); g(:,1) = T(idx);

Comparing elements of a vector.

[g(:,2), idx] = unique(R); g(:,1) = T(idx);

5 giorni ago | 1

Answered

Create lookup table for cell array

Is this what you want? [num2cell(1:9)' Codeword(:)]

Create lookup table for cell array

Is this what you want? [num2cell(1:9)' Codeword(:)]

5 giorni ago | 0

| accepted

Answered

Check all values in a table if any is "NAN"

This may work for your case tbl = fillmissing(tbl,'constant',1); assuming the NaNs are the only values that count as missing f...

Check all values in a table if any is "NAN"

This may work for your case tbl = fillmissing(tbl,'constant',1); assuming the NaNs are the only values that count as missing f...

7 giorni ago | 1

| accepted

Answered

Need help creating an matrix that includes probability

There are many ways to generate pseudorandom numbers in MATLAB. Since this sounds like homework, I'll just point you to this doc...

Need help creating an matrix that includes probability

There are many ways to generate pseudorandom numbers in MATLAB. Since this sounds like homework, I'll just point you to this doc...

7 giorni ago | 0

Answered

Plot two arrays as x and y and select the maximum point

The first thing is trivial ... plot(V,M,'.') I don't understand what you mean by "maximize both" or "do it graphically".

Plot two arrays as x and y and select the maximum point

The first thing is trivial ... plot(V,M,'.') I don't understand what you mean by "maximize both" or "do it graphically".

7 giorni ago | 0

| accepted

Answered

Computing determinant of matrix A using LU factorization

If I use the lu function from MATLAB (instead of your lufact function), I get the expected result. So, I'd double-check your LU ...

Computing determinant of matrix A using LU factorization

If I use the lu function from MATLAB (instead of your lufact function), I get the expected result. So, I'd double-check your LU ...

7 giorni ago | 0

Answered

Invalid expression. Check for missing multiplication operator, missing or unbalanced delimiters, or other syntax error. To construct matrices, use brackets instead of parentheses

I've spotted two errors so far. (1) Where you have 0.5th where you presumably want 0.5*th (2) In that same line, you typo'e...

Invalid expression. Check for missing multiplication operator, missing or unbalanced delimiters, or other syntax error. To construct matrices, use brackets instead of parentheses

I've spotted two errors so far. (1) Where you have 0.5th where you presumably want 0.5*th (2) In that same line, you typo'e...

7 giorni ago | 0

Answered

convert string to number or array

I'm guessing it's the space that is causing the problem. Run your array through x = regexprep(x,' ',''); first to remove the s...

convert string to number or array

I'm guessing it's the space that is causing the problem. Run your array through x = regexprep(x,' ',''); first to remove the s...

7 giorni ago | 1

| accepted

Answered

Scatter3: How can I change the size of a particular marker?

This puzzled me for a bit -- until I read the documentation a bit more carefully. For scatter3, the marker size specified is th...

Scatter3: How can I change the size of a particular marker?

This puzzled me for a bit -- until I read the documentation a bit more carefully. For scatter3, the marker size specified is th...

8 giorni ago | 0

| accepted

Answered

Using two vectors to get the third one

This is virtually equivalent to Fangjun's solution. But it uses some intuitive variable names (and comments) to help you underst...

Using two vectors to get the third one

This is virtually equivalent to Fangjun's solution. But it uses some intuitive variable names (and comments) to help you underst...

8 giorni ago | 1

Answered

Index exceeds the number of array elements (5)

You have initialized x and y to be vectors of length 5. But in your for loop, i reaches the value value 5, and then you try to a...

Index exceeds the number of array elements (5)

You have initialized x and y to be vectors of length 5. But in your for loop, i reaches the value value 5, and then you try to a...

8 giorni ago | 0

| accepted

Answered

Plot function is not working

Your plotting code is trying to select just one element from the t and y vectors. I think you want this instead: plot(t,y) (I...

Plot function is not working

Your plotting code is trying to select just one element from the t and y vectors. I think you want this instead: plot(t,y) (I...

8 giorni ago | 0

| accepted

Answered

Passing array as an input argument

Is that how you are calling the function, or is it the function header (inside the function file itself)? If that is how you ar...

Passing array as an input argument

Is that how you are calling the function, or is it the function header (inside the function file itself)? If that is how you ar...

9 giorni ago | 0

| accepted

Answered

How to draw a star in matlab

There are two places in your code where you wrote 6pi instead of 6*pi Assuming you are using the MATLAB editor, you should s...

How to draw a star in matlab

There are two places in your code where you wrote 6pi instead of 6*pi Assuming you are using the MATLAB editor, you should s...

9 giorni ago | 0

Answered

how to solve equation without values

I suggest you read the documentation about simplifying symblic expressions for the Symbolic Math Toolbox.

how to solve equation without values

I suggest you read the documentation about simplifying symblic expressions for the Symbolic Math Toolbox.

9 giorni ago | 0

Answered

For loop with multiple arrays

You don't need a loop: % These are tot defined in your code, so I made up some numbers max_speed = 180; Rho_fuel = 1; Powe...

For loop with multiple arrays

You don't need a loop: % These are tot defined in your code, so I made up some numbers max_speed = 180; Rho_fuel = 1; Powe...

9 giorni ago | 0

Answered

How to plot unitstep function??

I think you want to enclose these terms exp(-3*t) - exp(-6*t) in parentheses, so that they are both multiplied by the heavisid...

How to plot unitstep function??

I think you want to enclose these terms exp(-3*t) - exp(-6*t) in parentheses, so that they are both multiplied by the heavisid...

10 giorni ago | 0

Answered

Get correlation between segments of two matrix

% Some made-up data matrix1 = randn(2325,25); matrix2 = randn(2175,25); % Define the segment size, for generality segment ...

Get correlation between segments of two matrix

% Some made-up data matrix1 = randn(2325,25); matrix2 = randn(2175,25); % Define the segment size, for generality segment ...

10 giorni ago | 0

| accepted

Answered

'Dimensions of arrays being concatenated are not consistent' when using isequal

What sizes are updated1 and dist1 (and the other pair)? [updated1, dist1] is a horizontal concatenation.

'Dimensions of arrays being concatenated are not consistent' when using isequal

What sizes are updated1 and dist1 (and the other pair)? [updated1, dist1] is a horizontal concatenation.

10 giorni ago | 0

| accepted

Answered

Efficiently add missing parts to the table

I don't work with tables much, and this is a bit awkward, but it should work: % Make up a bit of pretend data, and create a tab...

Efficiently add missing parts to the table

I don't work with tables much, and this is a bit awkward, but it should work: % Make up a bit of pretend data, and create a tab...

11 giorni ago | 0

| accepted

Answered

How to create groups by using labels?

Here is one way: V = [ 1 2 3 4 5 6 7 8]; L = { 'A', 'A', 'A', 'C', 'C', 'C', 'A', 'B' }; [tf,loc] = ismember(L,unique(L)); ...

How to create groups by using labels?

Here is one way: V = [ 1 2 3 4 5 6 7 8]; L = { 'A', 'A', 'A', 'C', 'C', 'C', 'A', 'B' }; [tf,loc] = ismember(L,unique(L)); ...

11 giorni ago | 1

| accepted

Answered

Index in position 1 is invalid. Array indices must be positive integers or logical values.

Just a guess, but I think you probably named a variable dot, which is being used instead of the function you want. What does w...

Index in position 1 is invalid. Array indices must be positive integers or logical values.

Just a guess, but I think you probably named a variable dot, which is being used instead of the function you want. What does w...

11 giorni ago | 0

| accepted

Answered

group equal value in array

If you get the RunLength utility from the File Exchange, it will give you the output vector you want and the counts, in one func...

group equal value in array

If you get the RunLength utility from the File Exchange, it will give you the output vector you want and the counts, in one func...

11 giorni ago | 0

Answered

array exceeds maximum array size preference.

In this line of code t = [0:10^20]; You are trying to create a vector that is length 10^20. That is ... uh ... big. If I did ...

array exceeds maximum array size preference.

In this line of code t = [0:10^20]; You are trying to create a vector that is length 10^20. That is ... uh ... big. If I did ...

11 giorni ago | 0