답변 있음

Switch not recognizing that 0 is greater than -1

Quoting the Tips section of the documentation for switch: "A case_expression cannot include relational operators such as < or >...

Switch not recognizing that 0 is greater than -1

Quoting the Tips section of the documentation for switch: "A case_expression cannot include relational operators such as < or >...

약 15시간 전 | 0

답변 있음

Simplify code with nested if

% A little pretend data, where I only fill in the 4th column with a few months C = cell(5,6); C(:,4) = {'Jan';'Jan';'Dec';'Mar...

Simplify code with nested if

% A little pretend data, where I only fill in the 4th column with a few months C = cell(5,6); C(:,4) = {'Jan';'Jan';'Dec';'Mar...

약 16시간 전 | 0

답변 있음

Writing a script that mirrors the abs function? I'm doing something wrong but not sure what

I think you meant x=input(prompt)

Writing a script that mirrors the abs function? I'm doing something wrong but not sure what

I think you meant x=input(prompt)

2일 전 | 0

답변 있음

I have problem writing a matlab function

The coefficient (5.1/(4*pi^2)) is multiplying the term you have called x, which is not correct. It might have been easier t...

I have problem writing a matlab function

The coefficient (5.1/(4*pi^2)) is multiplying the term you have called x, which is not correct. It might have been easier t...

3일 전 | 1

답변 있음

combination and their sum

A = [4 2; 5 7; 3 1]; m = size(A,1); output = []; for j = 1:2 output = [output; A(:,j)']; for i = 1:m ...

combination and their sum

A = [4 2; 5 7; 3 1]; m = size(A,1); output = []; for j = 1:2 output = [output; A(:,j)']; for i = 1:m ...

4일 전 | 1

답변 있음

Why is the or statement making something true?

You need Overall_max_score==scores(1,3) | Overall_max_score==scores(2,3) <etc> You could do this more concisely as ismember(O...

Why is the or statement making something true?

You need Overall_max_score==scores(1,3) | Overall_max_score==scores(2,3) <etc> You could do this more concisely as ismember(O...

6일 전 | 0

답변 있음

Principal Component Analysis - return data (stock market data)

You might want to check out my tutorial-style PCA answer here. I think one helpful way to think about your 262x5 output is that...

Principal Component Analysis - return data (stock market data)

You might want to check out my tutorial-style PCA answer here. I think one helpful way to think about your 262x5 output is that...

6일 전 | 0

답변 있음

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...

7일 전 | 0

답변 있음

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...

8일 전 | 0

| 수락됨

답변 있음

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);

8일 전 | 0

| 수락됨

답변 있음

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...

9일 전 | 0

답변 있음

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...

10일 전 | 0

| 수락됨

답변 있음

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...

10일 전 | 0

| 수락됨

답변 있음

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(:)]

12일 전 | 0

| 수락됨

답변 있음

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...

13일 전 | 1

| 수락됨

답변 있음

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...

14일 전 | 0

답변 있음

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".

14일 전 | 0

| 수락됨

답변 있음

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 ...

14일 전 | 0

답변 있음

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...

14일 전 | 0

답변 있음

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...

14일 전 | 1

| 수락됨

답변 있음

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...

15일 전 | 0

| 수락됨

답변 있음

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...

15일 전 | 1

답변 있음

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...

15일 전 | 0

| 수락됨

답변 있음

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...

15일 전 | 0

| 수락됨

답변 있음

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...

15일 전 | 0

| 수락됨

답변 있음

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...

16일 전 | 0

답변 있음

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.

16일 전 | 0

답변 있음

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...

16일 전 | 0

답변 있음

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...

16일 전 | 0