Beantwortet
How can I find the roots of only one equation using fsolve?
Do a plot of h versus z for a sufficiently large positive range of z and make an estimate of the z location of the first zero cr...

fast 10 Jahre vor | 0

Beantwortet
To find the number of sections with negative values
Let x be the third column of your data matrix. f = find(diff([false;x<0;false])~=0); ns = length(find(f(2:2:end)-f(1:2...

fast 10 Jahre vor | 0

Beantwortet
how to find the manhattan distance between 2 matrices of defferent size
I would assume you mean you want the “manhattan distance”, (otherwise known as the L1 distance,) between p and each separate row...

fast 10 Jahre vor | 0

| akzeptiert

Beantwortet
How to repeat rows of a matrix sequentially?
Let your present 24 x 1 column vector be called x. x2 = reshape(repmat(x.’,20,1),[],1);

fast 10 Jahre vor | 0

Beantwortet
matrix column multiplication with rows of another matrix
Let M be your 15 x 15 matrix and A be your n x 3 matrix. B = zeros(size(M,1),3,size(A,1)); % A three-dimensional result ...

fast 10 Jahre vor | 0

Beantwortet
How can i get this function to display (0,0,0) when it goes through a,b and A being assigned values more than once?
As you originally stated this problem, Cameron, P was to be the integer perimeter of an isosceles triangle, a an integer length ...

fast 10 Jahre vor | 0

Beantwortet
calculate the probability of comparation of two variables
If f1(x) is the probability density of one distribution and f2(y) a second one, and if they are independent, the probability tha...

fast 10 Jahre vor | 0

| akzeptiert

Beantwortet
How can I find radius of any valley/peak of a signals?
The general formula for the curvature of a function y = f(x) is: K = ±d2y/dx2/(1+(dy/dx)^2)^(3/2) where the sign ambigu...

fast 10 Jahre vor | 0

Beantwortet
How to draw a log function?
The quantity f(log10(f(x)) does not yield the solution to log10(y) = 1 + log10(x). It is actually equal to f(log10(f(x)) ...

fast 10 Jahre vor | 0

Beantwortet
Can someone help me with my if statements in my function?
Your test “IntTestP==0” does not accomplish what you think it does. The only way “fix((fix(P)-P)+1)” can be zero is for P to be...

fast 10 Jahre vor | 0

Beantwortet
How to write this matrix better?
k = 1e6*(diag(s(1:22),1)+diag(s(1:22),-1)+... diag(-[s(1:22),0]-[0,s(1:22)])); I am assuming s is a row vecto...

fast 10 Jahre vor | 0

| akzeptiert

Beantwortet
Create a new matrix of the old matrix
[m,n] = size(A); B = zeros(m,n+m-1); [I,J] = ndgrid(1:m,1:n); B(I+m*(J-I+m-1)) = A(I+m*(J-1));

fast 10 Jahre vor | 1

| akzeptiert

Beantwortet
How to make one element in a matrix the same for other elements?
You want every other element in the second row to be set equal to the first element? A(2,:) = A(2.1); Or do you have ot...

fast 10 Jahre vor | 0

Beantwortet
How can i select random sample from mixture of two normal distributions in MATLAB ?
r = rand(100,1)>=.05; R1 = normrnd(0,sqrt(25),100,1); R2 = normrnd(0,sqrt(1),100,1); S = (1-r).*R1+r.*R2; S co...

fast 10 Jahre vor | 2

| akzeptiert

Beantwortet
Displaying a more precise answer when using diff()
In your code you have asked for the derivative of the constant 1, and of course its derivative will be zero. You need to find t...

fast 10 Jahre vor | 0

| akzeptiert

Beantwortet
How to create a corresponce between 2 column vector? (Replicating the vlookup funcion of excel)
[L,ix] = ismember(C,A); D = B(ix(L));

fast 10 Jahre vor | 0

| akzeptiert

Beantwortet
Hello everyone, i tried to understand and implement the sum product algorithm with following examples . can someone help me to implement this in matlab coding?
The code is wrong in the innermost loop. I believe it should be: for ii=1:4 if H(ii,j)==1 && i~=ii mul=mul*...

fast 10 Jahre vor | 0

| akzeptiert

Beantwortet
Hello Everyone, I have a Matlab problem related to random combinations of number and it goes like this:
Specifying covariance values between random variables does not necessarily determine their joint probability distributions. For...

fast 10 Jahre vor | 0

Beantwortet
How many times this for loop will execute
As to the “why” the for-loop does not accept any changes you might make to its variable, in this case ‘i’, as it repeats. So ev...

fast 10 Jahre vor | 0

Beantwortet
Nearly identical code, hugely different runtimes
The progress of your routine will be extremely sensitive to the value you give to ‘rmax’ in the one code or ‘moldia’ in the othe...

fast 10 Jahre vor | 0

Beantwortet
Cross Product multi Dim data
Actually you can use matlab's 'cross' function. A = cat(4,u1,v1,w1); % Combine the three components in the 4th dimension ...

etwa 10 Jahre vor | 0

| akzeptiert

Beantwortet
How can i speed up the following?
You can turn this into ordinary matrix multiplication. Since matlab is specially optimized for matrix multiplication, it might ...

etwa 10 Jahre vor | 1

| akzeptiert

Beantwortet
How to find the number consecutive elements in each row of a matrix?
I will give a method for a single row of integers. Let x be such a row. n = sum(diff(x)==1); That should be the number...

etwa 10 Jahre vor | 0

Beantwortet
If statement with 2 commands
Your code should be: if DMS(1,3) == 60 DMS (1,2) = DMS (1,2) + 1; DMS(1,3) = 0; end The '&' operator is...

etwa 10 Jahre vor | 0

| akzeptiert

Beantwortet
I've written a simple code in matlab. It worked a few times, but then later started showing "surf error". What could be the reason? I am not an expert in coding or matlab.
Well quite obviously somewhere along the line your 'a' matrix has suddenly become other than 44 x 44 in size. Your task will be...

etwa 10 Jahre vor | 0

| akzeptiert

Beantwortet
Calculating the percentage of numbers in my matrix
P = sum(A(:)<10)/numel(A)*100;

etwa 10 Jahre vor | 0

| akzeptiert

Beantwortet
is there anything wrong with my function? MATRIX
You've written the code for v1 and v2 incorrectly. It should be: v1 = MatrixA*x1-VectorB; v2 = MatrixA*x2-VectorB; ...

etwa 10 Jahre vor | 0

Beantwortet
Rounding numbers using a condition?
Let the "numbers ranging from 95 to 116" be in a row vector u, and the numbers 99, 104, and 115 be in a column vector v. [...

etwa 10 Jahre vor | 1

| akzeptiert

Beantwortet
How to generate a matrix G from 3 different square matrices?
Where you wrote: for i=r1+1:1:r2 for j=c1+1:1:c2 G(i,j)=B(i-2,j-2); end end should have been wr...

etwa 10 Jahre vor | 0

| akzeptiert

Beantwortet
Count the length of repeated value sets in an array?
f = find(diff([false,x==1,false])~=0); L = f(2:2:end)-f(1:2:end-1);

etwa 10 Jahre vor | 0

Mehr laden