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

etwa 6 Jahre vor | 1

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

etwa 6 Jahre vor | 0

| akzeptiert

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

etwa 6 Jahre vor | 2

| akzeptiert

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

etwa 6 Jahre vor | 0

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

etwa 6 Jahre vor | 1

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

etwa 6 Jahre vor | 0

| akzeptiert

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

etwa 6 Jahre vor | 0

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

etwa 6 Jahre vor | 1

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

etwa 6 Jahre vor | 0

| akzeptiert

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

etwa 6 Jahre vor | 0

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

etwa 6 Jahre vor | 0

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

etwa 6 Jahre vor | 3

| akzeptiert

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

etwa 6 Jahre vor | 0

| akzeptiert

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

etwa 6 Jahre vor | 0

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

etwa 6 Jahre vor | 0

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

etwa 6 Jahre vor | 0

| akzeptiert

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

etwa 6 Jahre vor | 1

| akzeptiert

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

etwa 6 Jahre vor | 0

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

etwa 6 Jahre vor | 0

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

etwa 6 Jahre vor | 0

| akzeptiert

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

etwa 6 Jahre vor | 2

| akzeptiert

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

etwa 6 Jahre vor | 0

| akzeptiert

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

etwa 6 Jahre vor | 0

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

mehr als 6 Jahre vor | 0

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

mehr als 6 Jahre vor | 0

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

mehr als 6 Jahre vor | 1

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

mehr als 6 Jahre vor | 1

| akzeptiert

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

mehr als 6 Jahre vor | 0

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

mehr als 6 Jahre vor | 1

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

mehr als 6 Jahre vor | 0

| akzeptiert

Mehr laden