Beantwortet
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

etwa 9 Jahre vor | 1

| akzeptiert

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

etwa 9 Jahre vor | 0

| akzeptiert

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

etwa 9 Jahre vor | 2

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

etwa 9 Jahre vor | 2

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

etwa 9 Jahre vor | 0

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

etwa 9 Jahre vor | 0

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

etwa 9 Jahre vor | 0

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

etwa 9 Jahre vor | 0

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

etwa 9 Jahre vor | 0

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

etwa 9 Jahre vor | 2

| akzeptiert

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

mehr als 9 Jahre vor | 0

| akzeptiert

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

mehr als 9 Jahre vor | 0

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

mehr als 9 Jahre vor | 1

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

mehr als 9 Jahre vor | 0

| akzeptiert

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

mehr als 9 Jahre vor | 0

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

mehr als 9 Jahre vor | 1

| akzeptiert

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

mehr als 9 Jahre vor | 0

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

mehr als 9 Jahre vor | 0

| akzeptiert

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

mehr als 9 Jahre vor | 1

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

mehr als 9 Jahre vor | 0

| akzeptiert

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

mehr als 9 Jahre vor | 1

| akzeptiert

Beantwortet
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

mehr als 9 Jahre vor | 1

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

mehr als 9 Jahre vor | 1

| akzeptiert

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

mehr als 9 Jahre vor | 0

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

mehr als 9 Jahre vor | 0

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

mehr als 9 Jahre vor | 1

| akzeptiert

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

mehr als 9 Jahre vor | 0

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

mehr als 9 Jahre vor | 0

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

mehr als 9 Jahre vor | 0

| akzeptiert

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

mehr als 9 Jahre vor | 0

Mehr laden