Respondida
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

alrededor de 9 años hace | 1

| aceptada

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

alrededor de 9 años hace | 0

| aceptada

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

más de 9 años hace | 2

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

más de 9 años hace | 2

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

más de 9 años hace | 0

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

más de 9 años hace | 0

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

más de 9 años hace | 0

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

más de 9 años hace | 0

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

más de 9 años hace | 0

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

más de 9 años hace | 2

| aceptada

Respondida
Remove row in numeric data
Dataset = Dataset(1:3:end,:);

más de 9 años hace | 0

| aceptada

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

más de 9 años hace | 0

Respondida
Uninterrupted segment length?
f = find(diff([false,Indexes==2,false])~=0); output = f(2:2:length(f))-f(1:2:length(f));

más de 9 años hace | 1

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

más de 9 años hace | 0

| aceptada

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

más de 9 años hace | 0

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

más de 9 años hace | 1

| aceptada

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

más de 9 años hace | 0

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

más de 9 años hace | 0

| aceptada

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

más de 9 años hace | 1

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

más de 9 años hace | 0

| aceptada

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

más de 9 años hace | 1

| aceptada

Respondida
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

más de 9 años hace | 1

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

más de 9 años hace | 1

| aceptada

Respondida
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.’;

más de 9 años hace | 0

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

más de 9 años hace | 0

Respondida
Create new matrix by deleting columns with negative numbers from old matrix
M = A(:,all(A>=0,1));

más de 9 años hace | 1

| aceptada

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

más de 9 años hace | 0

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

más de 9 años hace | 0

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

más de 9 años hace | 0

| aceptada

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

más de 9 años hace | 0

Cargar más