A répondu
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 ...

environ 6 ans il y a | 1

A répondu
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);...

environ 6 ans il y a | 0

| A accepté

A répondu
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...

environ 6 ans il y a | 2

| A accepté

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

environ 6 ans il y a | 0

A répondu
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...

environ 6 ans il y a | 1

A répondu
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...

environ 6 ans il y a | 0

| A accepté

A répondu
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...

environ 6 ans il y a | 0

A répondu
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)

environ 6 ans il y a | 1

A répondu
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. ...

environ 6 ans il y a | 0

| A accepté

A répondu
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 ...

environ 6 ans il y a | 0

A répondu
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 ....

environ 6 ans il y a | 0

A répondu
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...

environ 6 ans il y a | 3

| A accepté

A répondu
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...

environ 6 ans il y a | 0

| A accepté

A répondu
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...

environ 6 ans il y a | 0

A répondu
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...

environ 6 ans il y a | 0

A répondu
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); ...

environ 6 ans il y a | 0

| A accepté

A répondu
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. ...

environ 6 ans il y a | 1

| A accepté

A répondu
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...

environ 6 ans il y a | 0

A répondu
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...

environ 6 ans il y a | 0

A répondu
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...

environ 6 ans il y a | 0

| A accepté

A répondu
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...

environ 6 ans il y a | 2

| A accepté

A répondu
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...

environ 6 ans il y a | 0

| A accepté

A répondu
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));

environ 6 ans il y a | 0

A répondu
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 "...

environ 6 ans il y a | 0

A répondu
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);

plus de 6 ans il y a | 0

A répondu
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...

plus de 6 ans il y a | 1

A répondu
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...

plus de 6 ans il y a | 1

| A accepté

A répondu
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...

plus de 6 ans il y a | 0

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

plus de 6 ans il y a | 1

A répondu
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...

plus de 6 ans il y a | 0

| A accepté

Charger plus