統計
All
Feeds
回答済み
Corrcoef of two variables of unequal lengths
Mathworks states in their description of corrcoef, "R = corrcoef(X) returns a matrix R of correlation coefficients calculated ...
Corrcoef of two variables of unequal lengths
Mathworks states in their description of corrcoef, "R = corrcoef(X) returns a matrix R of correlation coefficients calculated ...
5年弱 前 | 0
| 採用済み
回答済み
Eigenvectors are not orthogonal for some skew-symmetric matrices, why?
Your matrix A is _"defective"_ , meaning that its eigenvalues are not all distinct. In fact, it has only three distinct eigenva...
Eigenvectors are not orthogonal for some skew-symmetric matrices, why?
Your matrix A is _"defective"_ , meaning that its eigenvalues are not all distinct. In fact, it has only three distinct eigenva...
6年以上 前 | 1
| 採用済み
回答済み
Sum of highest length of consecutive lowest values from a array.
L = min(A); f = find(diff([false,A==L,false])~=0); h = L*max(f(2:2:end)-f(1:2:end-1)); h is the highest sum of consec...
Sum of highest length of consecutive lowest values from a array.
L = min(A); f = find(diff([false,A==L,false])~=0); h = L*max(f(2:2:end)-f(1:2:end-1)); h is the highest sum of consec...
6年以上 前 | 0
回答済み
What condition to use for checking whether at least a single negative element in a array?
Use the 'any' logical function. if any(A.*B<0) If you are dealing with an array, C, of more than one dimension, do this:...
What condition to use for checking whether at least a single negative element in a array?
Use the 'any' logical function. if any(A.*B<0) If you are dealing with an array, C, of more than one dimension, do this:...
6年以上 前 | 0
| 採用済み
回答済み
How to Make a Matrix Diagonal with Matlab?
Call on Matlab's 'svd' function. Read about it at: https://www.mathworks.com/help/matlab/ref/svd.html or possible you need th...
How to Make a Matrix Diagonal with Matlab?
Call on Matlab's 'svd' function. Read about it at: https://www.mathworks.com/help/matlab/ref/svd.html or possible you need th...
6年以上 前 | 1
回答済み
Finding if a vector is a subset
The following should be faster: m = size(a,2); n = size(b,2); for k = 1:n-m+1 s = all(a==b(k:k+m-1)); if s,...
Finding if a vector is a subset
The following should be faster: m = size(a,2); n = size(b,2); for k = 1:n-m+1 s = all(a==b(k:k+m-1)); if s,...
6年以上 前 | 0
| 採用済み
回答済み
How to plot level curves of f(x,y) = 2x^2 + 5y^2. f(x,y) = c for c = 1,2,3,4,5,6
Your "level" curves are all ellipses and can most easily be generated by: t = linspace(0,2*pi); x = sqrt(c/2)*cos(t); ...
How to plot level curves of f(x,y) = 2x^2 + 5y^2. f(x,y) = c for c = 1,2,3,4,5,6
Your "level" curves are all ellipses and can most easily be generated by: t = linspace(0,2*pi); x = sqrt(c/2)*cos(t); ...
6年以上 前 | 0
回答済み
how to make a function (named pcc ) that solves the cartesian product of 2 strings A(with n elements) and B(with m elements)?
Assume A and B are row strings. C = [reshape(repmat(A,length(B),1),[],1),repmat(B(:),length(A),1)]; The two-element rows...
how to make a function (named pcc ) that solves the cartesian product of 2 strings A(with n elements) and B(with m elements)?
Assume A and B are row strings. C = [reshape(repmat(A,length(B),1),[],1),repmat(B(:),length(A),1)]; The two-element rows...
6年以上 前 | 0
回答済み
how to create function half adder in matlab
If the input bits are numeric scalars or logical values, b1 and b2, then the sum bit, 's', would be: s = b1 xor b2; or e...
how to create function half adder in matlab
If the input bits are numeric scalars or logical values, b1 and b2, then the sum bit, 's', would be: s = b1 xor b2; or e...
6年以上 前 | 0
| 採用済み
回答済み
Using nested loops, write a Matlab program that goes through all elements of a matrix (2D array) and replaces every element that is either a multiple of 5 or 7 with -1.
Your test on a number x from your array can be: if round(x/5)==x/5 | round(x/7)==x/7 (Doing fprintf('-1') just prints ou...
Using nested loops, write a Matlab program that goes through all elements of a matrix (2D array) and replaces every element that is either a multiple of 5 or 7 with -1.
Your test on a number x from your array can be: if round(x/5)==x/5 | round(x/7)==x/7 (Doing fprintf('-1') just prints ou...
6年以上 前 | 0
回答済み
What is the output?
The vector x has only three elements, [0,.3,.6], so the 'for' instruction reads: for n = 4:2 Therefore the loop will not...
What is the output?
The vector x has only three elements, [0,.3,.6], so the 'for' instruction reads: for n = 4:2 Therefore the loop will not...
6年以上 前 | 0
回答済み
Please help me convert equation to matlab code.
N = 100; % <-- Choose some large number s = x; for n = 2*N-1:-2:1 s = x - s*x^2/((n+2)*(n+1)); end (I t...
Please help me convert equation to matlab code.
N = 100; % <-- Choose some large number s = x; for n = 2*N-1:-2:1 s = x - s*x^2/((n+2)*(n+1)); end (I t...
6年以上 前 | 0
回答済み
Why am I getting Inf in my matrix
It is easily possible for two finite nonzero numbers to have a quotient so large that Matlab must give 'inf' as its value. For ...
Why am I getting Inf in my matrix
It is easily possible for two finite nonzero numbers to have a quotient so large that Matlab must give 'inf' as its value. For ...
6年以上 前 | 1
| 採用済み
回答済み
Multiply a column by a number
Let Ar be the name of the array. Ar(:,6) = 4*Ar(:,6); What could be simpler? Since 4 is a scalar, it is automatically a...
Multiply a column by a number
Let Ar be the name of the array. Ar(:,6) = 4*Ar(:,6); What could be simpler? Since 4 is a scalar, it is automatically a...
6年以上 前 | 0
回答済み
how to use nested for loop by grabbing one column and subtracting another column.
Your n value will be 1478, but in z(i,j+1) you have allowed the j+1 index to get as large as 1479 because you have "for j=1:1:n"...
how to use nested for loop by grabbing one column and subtracting another column.
Your n value will be 1478, but in z(i,j+1) you have allowed the j+1 index to get as large as 1479 because you have "for j=1:1:n"...
6年以上 前 | 0
回答済み
Why does y come out as one number?
The scalar result is caused by the use of matrix division rather than element-by-element division. Replace '/' by './'. Simila...
Why does y come out as one number?
The scalar result is caused by the use of matrix division rather than element-by-element division. Replace '/' by './'. Simila...
6年以上 前 | 0
回答済み
Lagrange Interpolation code error
The message is caused by your not defining or properly entering the value of vector 'xi'.
Lagrange Interpolation code error
The message is caused by your not defining or properly entering the value of vector 'xi'.
6年以上 前 | 0
回答済み
Trapezoidal rule to find total work?
I would think your code should be this: work = 0; for k = 2:length(t) work = work + (F(k)+F(k-1))/2*(v(k-1)+v(k))/2...
Trapezoidal rule to find total work?
I would think your code should be this: work = 0; for k = 2:length(t) work = work + (F(k)+F(k-1))/2*(v(k-1)+v(k))/2...
6年以上 前 | 0
| 採用済み
回答済み
How to do polynomial differentiation
Let P be the usual Matlab row vector of coefficients of a polynomial. Then, (as we all learned in calculus,) the corresponding ...
How to do polynomial differentiation
Let P be the usual Matlab row vector of coefficients of a polynomial. Then, (as we all learned in calculus,) the corresponding ...
6年以上 前 | 2
| 採用済み
回答済み
convert two column matrices into one column matrix
In the example you gave do this: C = zeros(9,1); C(1:2:end) = A; C(2:2:end) = B; For a general answer you need to ...
convert two column matrices into one column matrix
In the example you gave do this: C = zeros(9,1); C(1:2:end) = A; C(2:2:end) = B; For a general answer you need to ...
6年以上 前 | 0
回答済み
Does 'i' after value stand for 'index', and if so why does it appear as part of the answer?
The 'i' in your result indicates a complex answer. I assume you are familiar with complex numbers. The 'i' represents the squa...
Does 'i' after value stand for 'index', and if so why does it appear as part of the answer?
The 'i' in your result indicates a complex answer. I assume you are familiar with complex numbers. The 'i' represents the squa...
6年以上 前 | 1
| 採用済み
回答済み
Representing base 4 numbers as "random walks"
The Matlab function 'dec2base' can be used to covert integers to character strings involving the characters '0', '1', '2', and '...
Representing base 4 numbers as "random walks"
The Matlab function 'dec2base' can be used to covert integers to character strings involving the characters '0', '1', '2', and '...
7年弱 前 | 0
回答済み
How to generate a joint probability matrix from a data matrix
Call the data matrix D. Then the two columns of D(:,2:3) are X and Y. XY = sortrows(D(:,2:3)); F = find( [true,any(XY(1...
How to generate a joint probability matrix from a data matrix
Call the data matrix D. Then the two columns of D(:,2:3) are X and Y. XY = sortrows(D(:,2:3)); F = find( [true,any(XY(1...
7年弱 前 | 0
回答済み
How can I write a program that indicates a number if it is integer or not?
If n is your number, then round(n)==n is true if and only if n is an integer
How can I write a program that indicates a number if it is integer or not?
If n is your number, then round(n)==n is true if and only if n is an integer
7年弱 前 | 0
回答済み
where can i use round function to make the function perfect
I would suggest initially multiplying both 'tendered' and 'price' by 100 and using 'round' on the result: tendered = round(...
where can i use round function to make the function perfect
I would suggest initially multiplying both 'tendered' and 'price' by 100 and using 'round' on the result: tendered = round(...
7年弱 前 | 0
| 採用済み
回答済み
if a & b
You can't use the "short circuit" forms of logical operations for operands other than scalars. The double symbol '&&' is the sh...
if a & b
You can't use the "short circuit" forms of logical operations for operands other than scalars. The double symbol '&&' is the sh...
7年弱 前 | 1
回答済み
How do I use an matrix of indices to reference values in another matrix without using a loop?
[a,b,c] = size(alltemps); % tempindex must be 1 x b x c savedtemp = reshape(alltemps(reshape(tempindex,1,[])+(0:a:a*(b*c-1...
How do I use an matrix of indices to reference values in another matrix without using a loop?
[a,b,c] = size(alltemps); % tempindex must be 1 x b x c savedtemp = reshape(alltemps(reshape(tempindex,1,[])+(0:a:a*(b*c-1...
7年弱 前 | 0
| 採用済み
回答済み
Solving a system of integral equations numerically
@Lewis: I noticed that the integrands in both of your integrals become infinite at the upper limit of integration, and this can ...
Solving a system of integral equations numerically
@Lewis: I noticed that the integrands in both of your integrals become infinite at the upper limit of integration, and this can ...
7年弱 前 | 0
回答済み
Solving a system of integral equations numerically
This is a problem you can solve using Matlab's 'fsolve' function. The fact that your objective function requires two numerical ...
Solving a system of integral equations numerically
This is a problem you can solve using Matlab's 'fsolve' function. The fact that your objective function requires two numerical ...
7年弱 前 | 0
回答済み
How to plot a circle centered on a line and passing through a point?
There are infinitely many ways a circle can be centered on a line and pass through a given point, except for the case when a lin...
How to plot a circle centered on a line and passing through a point?
There are infinitely many ways a circle can be centered on a line and pass through a given point, except for the case when a lin...
7年弱 前 | 0