답변 있음
Computational neuroscience - I have a 116x116x226 I need to calculate the eigenvalues for this array can anyone help me?
A 3D array is not a matrix, and matrix multiplication is not defined for such arrays. Eigenvalues and eigenvectors are defined ...

대략 6년 전 | 1

답변 있음
Duplicate a matrix using nested for loops
What's wrong with B = A; % ? However, if you absolutely must do it with nested for-loops then do: [m,n] = size(A);...

대략 6년 전 | 0

| 수락됨

답변 있음
2-D Ray Tracing
Let P1=[x1,y1] and P2=[x2,y2] be the two endpoints of a line segment of the reflecting "wall", and let P3 = [x3,y3] be a point o...

대략 6년 전 | 2

| 수락됨

답변 있음
A value belongs to an interval
To display the values you want write: A(4<A&A<5)

대략 6년 전 | 0

답변 있음
Combine multiple if statements for something more compact
You can replace the part of the code after "%Speed Conditions" but before "% Power and performance" by these lines: t = Vm...

대략 6년 전 | 1

답변 있음
bonsoire a tous ,commet je peut définir la taille d'une matrice ou d'un vecteur ? je veut par exemple une latrice de taille [m n]sachant que cette code ne me permet pas de faire ce que je veut
You can only do that if you assign values to every element of such a matrix. For example, you can set them all to zeros: M...

대략 6년 전 | 0

| 수락됨

답변 있음
Line 11 Error: Subscript indices must either be real positive integers or logicals.
In the line k2 = y(n+h*k1)*(3-t(n+1)*y(n+h*k1)); the quantity n+h*k1 may not be a positive integer. If so, it is invali...

대략 6년 전 | 0

답변 있음
checking that a user input is an integer
Test whether this is true. If so, 'prompt' is an integer, otherwise it is not. prompt==round(prompt)

대략 6년 전 | 1

답변 있음
what is wrong with my newton code? file attached
There are three things that need correcting 1. There is no need for the i=1 and i=i+1 commands. The 'for' does all that. ...

대략 6년 전 | 0

| 수락됨

답변 있음
How do I use for loops and if statements to find numbers in a two dimensional array and replace them?
Use the "linear" form of the array: for i = 1:length(A(:)) if A(i) < 0 % <- [Corrected] A(i) = 0; end ...

대략 6년 전 | 0

답변 있음
How do i change this " while loop " to a for loop while still arriving to the same end product?
.... for i = 1:maxiter if abs(h) <= tol break end ....

대략 6년 전 | 0

답변 있음
how can i draw circle in 3D space with 3 point ?
Let your three points be P1=[x1;y1;z1], P2=[x2;y2;z2], P3=[x3;y3;z3], and call the as yet unknown center P0 = [x0;y0;z0]. I wil...

대략 6년 전 | 3

| 수락됨

답변 있음
scalar multiplication of two vectors giving me NAN,both are of same dimensions.
A zero in one vector multiplied by a corresponding infinity in the other vector will give a NaN result. You would do well to ch...

대략 6년 전 | 0

| 수락됨

답변 있음
I have written a logic for co-occurance matrix but it is taking a lot of time, is there any other to built the logic?
In the code you have written the tests are false the great majority of the cases, and that suggests strongly that the method can...

대략 6년 전 | 0

답변 있음
Do the inverse operation of this reshape?
You have to know the dimensions of the original array in order to get back to that, in which case you simply do a another ‘resha...

대략 6년 전 | 0

답변 있음
matrix multiplication with probability
If p is a matrix the same size as A with the probability values you describe, do this: SA = size(A); a = rand(SA); ...

대략 6년 전 | 0

| 수락됨

답변 있음
Using normrnd to generate a random sequence
The best answer to your question is, “don’t use ‘normrnd’ for that purpose!” It is very much the wrong distribution for that. ...

대략 6년 전 | 1

| 수락됨

답변 있음
I have a textbook that provides me with code and I'm using the code that they have in the textbook, verbatim, on my Mac and it refuses to work.
You have misinterpreted the fifth (last) argument to be entered into the function. You have set it to pi/2 which is so small th...

대략 6년 전 | 0

답변 있음
Randomise List with Repetitions
Without your restriction as to the number of 20% images, you would be asking for a binary distribution for each set of 12 images...

대략 6년 전 | 0

답변 있음
Trying to plot a sine wave, getting a straight line.
You have placed your ’n’ variable outside the parentheses for the sine function. That would make it a straight line. It should...

대략 6년 전 | 0

| 수락됨

답변 있음
calculate area of boundary of set of 2d-data point
I would advise you to "close" the polygon so that the first point is the same as the last point. Otherwise, Matlab may be a bit...

대략 6년 전 | 2

| 수락됨

답변 있음
How to combine two trendline from two figures and find the angle?
polyfit(x,y,1) will give you [p,q] which represents the line y = p*x+q, so ‘p’ will be the slope of such a fitted line. Therefo...

대략 6년 전 | 0

| 수락됨

답변 있음
how to select a random number from the existing matrix in each column
[m,n] = size(A); Anew = A(randi(m,[1,n])+m*(0:n-1));

대략 6년 전 | 0

답변 있음
Physics Quıestion in Matlab
Matlab does not accept indices equal to zero. These can only be positive integers greater than zero. Therefore "x(0)=1;" and "...

대략 6년 전 | 0

답변 있음
How can I shuffle a matrix
AB = A; AB(2,9,6,13,4,11,8,15) = AB(9,2,13,6,11,4,15,8);

6년 초과 전 | 0

답변 있음
When solving a system of nonlinear equations, is it possible that some unknowns remain arbitrary?
Many things are possible with a set of equations involving a set of unknowns. The most common situation is that if there are an...

6년 초과 전 | 1

답변 있음
Randomize a string from input
To obtain a random permutation of 'first_word' you need the 'randperm' function, not 'randi': perm_of_first_word = first_w...

6년 초과 전 | 1

| 수락됨

답변 있음
Tabulate shortens array. Why?
The number of rows in the output of 'tabulate' is the number of unique values in the input, so there must have been 19231 unique...

6년 초과 전 | 0

답변 있음
How can i sum cells that equals in matrix
You can also use the 'all' function: sum(all(diff(a,1,2)==0))

6년 초과 전 | 1

답변 있음
Converting decimal to binary and vise versa
I’ll assume that the form of the binary version is a row vector, B, of eight ones or zeros, and that the "decimal" number is a d...

6년 초과 전 | 0

| 수락됨

더 보기