How to use matlab to generate a matrix with only - 1,1 elements randomly?

How to use matlab to generate a matrix with only - 1,1 elements randomly?


There is a problem with the method above. It produces random matrices of 0, - 1,1, not - 1 and 1
It should be changed to:
clear;
clc;
A = randInt (3,2);% produces an M * n-dimensional random matrix composed of 0 and 1
A (find (a = = 0)) = - 1;%%% is transformed into a matrix of - 1 and 1



How to remove the zero element in matrix by MATLAB


There is something wrong with this question
If it is one-dimensional, a (a = = 0) = [] can solve the problem
If it is multidimensional, a (a = = 0) = [] will change a into one-dimensional, and the result is similar to the above result. The reason is that the number of zeros in each row and column is different, so it can't keep multidimensional appearance, so it can only be elongated as one-dimensional
a =
4 4 4 2 2
4 0 3 2 2
2 1 2 4 3
3 0 5 4 4
1 0 0 1 4
>> a(a==0)=[]
a =
Columns 1 through 20
4 4 2 3 1 4 1 4 3 2 5 2 2 4 4 1 2 2 3 4
Column 21
four



Matlab how to generate a 393 * 1 matrix, matrix elements are 0.5


a=.5*ones(393,1);



Calculation: 1 / 2lg (2x + 2 change sign (x-1) + LG (change sign (x + 1) - change sign (x-1)) (x > 1)


1 / 2lg (2x + 2 change sign (x-1) + LG (change sign (x + 1) - change sign (x-1)) (x > 1) = 1 / 2lg [2x + 2 √ (x ^ 2-1)] + LG [√ (x + 1) - √ (x-1)] = 1 / 2lg [(x + 1) + 2 √ (x ^ 2-1) + (x-1)] + LG {2 / [√ (x + 1) + √ (x-1)]} = 1 / 2lg {[√ (x + 1) + √ (x-1)] ^ 2} + LG {2 / [√



Is life plural? If so, what is plural


lives



A parallelogram is still a parallelogram, right
Eager to get answers, give counter examples
Some of the answers are not necessarily, and say it is arbitrary quadrilateral, I have questions, want to get specific answers


Not necessarily, a square can be obtained. Of course, it can also be regarded as a special case of a parallelogram. In a broad sense, the result obtained by the oblique binomial drawing method of a parallelogram is still a parallelogram



About 120 words, a high level


Spring Festival is the most important festival in China .It’s to celebrate the lunar calendar ‘s new year .In the evening before the Spring Festival ,families get together and have a big meal .In ma...



In the triangle ABC, where / D is a point on AC / and CD and AB / m.n are BC respectively, the extension of the midpoint of AD / Mn intersects the extension of BA at the point E / to prove AE = an


Extend nm to F, make MF = nm, connect CF, connect DM, extend CF to g, connect AG
Easy to get: CF = BN, CG = BD = AC, DN = FG = an ab parallel CF, so the quadrilateral anfg is a parallelogram
So: AG is parallel to EF, so AE = FG, that is AE = an



Some sixth grade English phrases
It's next to the barber's
There is a cake shop on the left of the clothing shop
The grocery store is between the supermarket and the barber shop
The hotel is across the road
The noodle shop is next to the grocery store
There is a barber shop on the right side of the restaurant


1. Near the barbershop 2. There is a cake shop on the left of the clothes shop. 3. Gross is between the supermaket and the barbershop. 4. The restaurant is on the opposite of the road



The sum of the numerator and denominator of the simplest fraction is 13. If 4 is added to each numerator and denominator, the reduced fraction is 3 / 4. What is the original fraction?


The sum of the numerator and denominator is 13. The sum of the numerator and denominator is 21. The sum of the numerator and denominator of the third quarter is 7. The difference between the numerator and the denominator is three times. Multiply the numerator and denominator of the third quarter by three to get 9 out of 12. Subtract 4 from the numerator and denominator to get 5 out of 8