Réponse apportée
Can someone help me with a question to do with sequences and creating a function file that find n terms of sequence
a = a_0 + cumsum(3:3:3*n); % The sequence of first n terms s = sum(a); % The sum of these

environ 9 ans il y a | 1

| A accepté

Réponse apportée
Mean of Multiple Matrixes
m = (z1+z2+z3+z4+z5+z6+z7+z8+z9)/9; % The mean of each element

environ 9 ans il y a | 0

| A accepté

Réponse apportée
how ı can calculate area and volume ıf have 4 Coordinates like (x1,y1) (x2,y2) (x3,y3) (x4,y4)
Abdul, I will modify your question a little, since the volume of 2D objects is always zero. Instead let it be this: Calculate t...

plus de 9 ans il y a | 2

Réponse apportée
How to vectorize a specific for-loop
You might try the ‘hankel’ function: n = numel(text); nk = n-k+1; pattern = hankel(text(1:nk),text(nk:n));

plus de 9 ans il y a | 2

Réponse apportée
loop runs infinitely,
Oops! I've done something wrong and seemingly erased both my answer and Jan Simon's. I don't know how to correct it, but a tho...

plus de 9 ans il y a | 0

Réponse apportée
Subscripted assignment dimension mismatch error in valsx. How do I get rid of the error?
It is impossible to be sure about the cause of your error because you haven’t defined the nature of your various variables. How...

plus de 9 ans il y a | 0

Réponse apportée
Coding to Plot Ellipse
As you have written the parametric equations, for ϕ equal to zero you have a circle traced out with varying T. As ϕ increases, ...

plus de 9 ans il y a | 0

Réponse apportée
I want to generate a random number between 1 and 10, but I want the chance of a 10 to be greater
For n draws, do this: r = rand(n,1); card = ceil(18*r-10*(r-1/2).*(r>=1/2)); There will be a fifty percent chance o...

plus de 9 ans il y a | 0

Réponse apportée
Solving a single non-linear equation
It is likely that ‘solve’ is unable to find v as a function of x, as is so often the case, so you would then need to use ‘fzero’...

plus de 9 ans il y a | 0

Réponse apportée
Is there any way of joining these two for loops into one?
You don’t need any for-loops at all. Do this: A([1:K,n+1-K:n],:,:) = B([1:K,n+1-K:n],:,:); If you insist on one loop, ...

plus de 9 ans il y a | 2

| A accepté

Réponse apportée
Remove row in numeric data
Dataset = Dataset(1:3:end,:);

plus de 9 ans il y a | 0

| A accepté

Réponse apportée
Swapping a range of points in a matrix
If you prefer one-liners, try this, (again calling your matrix M): M([6:10,(1:5)+size(M,1)]) = M([(1:5)+size(M,1),6:10]); ...

plus de 9 ans il y a | 0

Réponse apportée
Uninterrupted segment length?
f = find(diff([false,Indexes==2,false])~=0); output = f(2:2:length(f))-f(1:2:length(f));

plus de 9 ans il y a | 1

Réponse apportée
How to vectorize random permutation of data
You wish to randomly permute each of the rows of ‘data’. Then do this: (Simplified) [m,n] = size(data); [~,p] = so...

plus de 9 ans il y a | 0

| A accepté

Réponse apportée
Swapping a range of points in a matrix
Suppose your matrix is called ‘M’. T = M(6:10,1); M(6:10,1) = M(1:5,2); M(1:5,2) = T;

plus de 9 ans il y a | 0

Réponse apportée
how can i extend a matrix with columns of random entries under the condition that the 3 randomn numbers in column 1-3 sum up to 1?
I wrote a function for the file exchange called ‘randfixedsum’ which will accomplish the task you have in mind. It will generat...

plus de 9 ans il y a | 1

| A accepté

Réponse apportée
Solve equation that contains sum analitically
With an appropriate use of the 'symsum' function, you can transform the summations in your expression into one without summation...

plus de 9 ans il y a | 0

Réponse apportée
How Can I replace the following for loop by vectorization?
Here's a single line code, but I'm not sure it's faster than, or even as fast as, your two nested for-loop solution: Cor...

plus de 9 ans il y a | 0

| A accepté

Réponse apportée
Can someone help me graph this function
X = -2*a:.001*a:2*a; Y = -2*b:.001*b:2*b; Z1 = c*sqrt(1+X.^2/a^2+Y.^2/b^2); Z2 = -c*sqrt(1+X.^2/a^2+Y.^2/b^2); ...

plus de 9 ans il y a | 1

Réponse apportée
Solve not working: Cannot find explicit solution
What you have are two simultaneous equations in two unknowns. The function ‘solve’ must receive both of the equations together ...

plus de 9 ans il y a | 0

| A accepté

Réponse apportée
Problem to delete rows in my matrix
The problem here is that you are reducing the row count of ‘res’ whenever you get a successive pair in column 3 that match. Hen...

plus de 9 ans il y a | 1

| A accepté

Réponse apportée
How do I pull data from two different matrices to form a new matrix?
p = repmat(I==1,1,10); <-- Corrected D = p.*D1+(1-p).*D2; % <-- The desired result

plus de 9 ans il y a | 1

Réponse apportée
Can anybody help me understanding this mentioned line of code?
The numerator is the Laplacian under the assumption that there is unit distance spacing between adjacent grid points of the pres...

plus de 9 ans il y a | 1

| A accepté

Réponse apportée
How to multiply values to specific elements in a matrix?
Assuming the number of ones in A is equal to the length of B, At = A.’; At(At==1) = B; A = At.’;

plus de 9 ans il y a | 0

Réponse apportée
Find eigenvalues without the function eig
The eigenvector/eigenvalue problem for a square matrix A tries to solve the problem: (A-s)*v = 0 where ’s’ is an approp...

plus de 9 ans il y a | 0

Réponse apportée
Create new matrix by deleting columns with negative numbers from old matrix
M = A(:,all(A>=0,1));

plus de 9 ans il y a | 1

| A accepté

Réponse apportée
How to change matrix values in matlab without loop
Assume A is n by n in size. A((1:n)+n*(0:n-1)) = a^2; A(n*(1:n)-(0:n-1)) = 2*a Note: If n is odd, the two diagonals...

plus de 9 ans il y a | 0

Réponse apportée
Eigenvalues and Eigenvectors Question
The ‘eig’ function “[v,d] = eig)A)” is a solution to the equation A*v = v*d where ‘d’ is a diagonal matrix and if possi...

plus de 9 ans il y a | 0

Réponse apportée
How to switch two values in a matrix?
If I understand the method in your example correctly, then using your definition of x and c, the following should accomplish the...

plus de 9 ans il y a | 0

| A accepté

Réponse apportée
How can I move in a matrix from right to left and up and down?
Let A be your matrix. r = 1; % Start at first row S = [zeros(1,size(A,2)-1),r]; % <-- For saving row positions for c ...

plus de 9 ans il y a | 0

Charger plus