Risposto

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

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

oltre 6 anni fa | 1

Risposto

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

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

oltre 6 anni fa | 0

| accettato

Risposto

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

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

oltre 6 anni fa | 2

| accettato

Risposto

A value belongs to an interval

To display the values you want write: A(4<A&A<5)

A value belongs to an interval

To display the values you want write: A(4<A&A<5)

oltre 6 anni fa | 0

Risposto

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

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

oltre 6 anni fa | 1

Risposto

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

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

oltre 6 anni fa | 0

| accettato

Risposto

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

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

oltre 6 anni fa | 0

Risposto

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)

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)

oltre 6 anni fa | 1

Risposto

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

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

oltre 6 anni fa | 0

| accettato

Risposto

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

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

oltre 6 anni fa | 0

Risposto

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

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

oltre 6 anni fa | 0

Risposto

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

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

oltre 6 anni fa | 3

| accettato

Risposto

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

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

oltre 6 anni fa | 0

| accettato

Risposto

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

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

oltre 6 anni fa | 0

Risposto

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

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

oltre 6 anni fa | 0

Risposto

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

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

oltre 6 anni fa | 0

| accettato

Risposto

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

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

oltre 6 anni fa | 1

| accettato

Risposto

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

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

oltre 6 anni fa | 0

Risposto

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

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

oltre 6 anni fa | 0

Risposto

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

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

oltre 6 anni fa | 0

| accettato

Risposto

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

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

oltre 6 anni fa | 2

| accettato

Risposto

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

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

oltre 6 anni fa | 0

| accettato

Risposto

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

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

oltre 6 anni fa | 0

Risposto

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

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

oltre 6 anni fa | 0

Risposto

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

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

oltre 6 anni fa | 0

Risposto

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

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

oltre 6 anni fa | 1

Risposto

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

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

oltre 6 anni fa | 1

| accettato

Risposto

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

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

oltre 6 anni fa | 0

Risposto

How can i sum cells that equals in matrix

You can also use the 'all' function: sum(all(diff(a,1,2)==0))

How can i sum cells that equals in matrix

You can also use the 'all' function: sum(all(diff(a,1,2)==0))

oltre 6 anni fa | 1

Risposto

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

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

oltre 6 anni fa | 0

| accettato