Réponse apportée
Comparing updated array from two consecutive iterations
Use a while loop that is sure to make at least two trips through. old = all NaNs so as to surely fail 1st test b = fa...

presque 9 ans il y a | 1

Réponse apportée
sortrows(data, [2,1]) is doing the 2nd round of sorting incorrectly in MATLAB R2017a
I would hazard the guess that in spite of their appearance using “format short” as you clearly have, the values in the second co...

presque 9 ans il y a | 1

Réponse apportée
How to define random points above and below a define line within a specific range
Let w be the allowed perpendicular distance of random points on either side of the line segment. Let x1 be the x-coordinate of ...

presque 9 ans il y a | 1

Réponse apportée
How to remove an specific array from matrix
[m,n] = size(A); for k = 1:m a = A(k,A(k,:)~=100); A(k,:) = [a,zeros(1,n-length(a))]; end

presque 9 ans il y a | 1

Réponse apportée
Creating a parameter which indicates adding values to only part of the elements in a Matrix?
p = 1:round(alpha*size(OldMatrix,1)); NewMatrix(p,:) = OldMatrix(p,:)+data;

presque 9 ans il y a | 0

Réponse apportée
How do I replace trapz with sum?
In place of “SY_comp=trapz(xy(1:M,1),xy(1:M,2))” you could write: SY_comp=1/2*sum(diff(xy(:,1)).*(xy(1:M-1,2)+xy*(2:M,2)));...

presque 9 ans il y a | 0

| A accepté

Réponse apportée
How can Fix the "find" with for loop
In your code you are assuming that the ‘find’ operation will always find an index from X that will match one in xe. The trouble...

presque 9 ans il y a | 0

Réponse apportée
while loop doesn't produce correct result
You have not placed the line "C = (2/(pi*(1-4*n^2)))^2;" inside the 'while' loop where it could be updated with changing values ...

presque 9 ans il y a | 1

| A accepté

Réponse apportée
How do I change the orientation of a marker randomly?
If you mean random orientation with respect to the cartesian coordinate origin, and if the orientation change is to be the same ...

presque 9 ans il y a | 0

Réponse apportée
My script won't run (error) how do I fix it?
The error message probably occurs when your vector ‘vec’ does not contain the value ‘targetVal’. In that case you repeatedly ei...

presque 9 ans il y a | 0

Réponse apportée
How can I solve this integral equation?
I would suggest utilizing a little calculus here: integral of a+b*T+c*T^2 w.r. T from T = T1 to T = T2 is equal to: ...

presque 9 ans il y a | 1

Réponse apportée
How to pre-allocate an empty matrix ?
Rather than stacking your ‘appnd_data’ successively by: for m = 1:length(s.labs) ...

presque 9 ans il y a | 1

Réponse apportée
How to obtain n smallest values in a 3-dimensional Matrix for each step in the 3rd dimension?
Let A be the original 3D array. [k,l,m] = size(A); A2 = reshape(A,[],m); N = zeros(n,2,m); for im = 1:m ...

presque 9 ans il y a | 1

| A accepté

Réponse apportée
How to sum up in matrix
N = [S,zeros(size(S,1),2)]; N(1,3) = 240; t = 240; for k = 2:size(S,1); if N(k,1)~=N(k-1,1) N(k,3) ...

presque 9 ans il y a | 0

Réponse apportée
could you write integral matlab code
This is a problem in calculus. The indefinite integral would be: 1/8*(sin(2*t)-cos(2*t)-2)*exp(-2*t) + C Note that this...

presque 9 ans il y a | 1

| A accepté

Réponse apportée
How to print out the exact value for a variable in the workspace?
If you want the value expressed in decimal form, in the great majority of cases these cannot be given exactly, since all our com...

presque 9 ans il y a | 0

Réponse apportée
how to find a mean for a set of values in a given data. ive got a data with 60000 values and i wanted to find mean for group of 1000 values so that i can get 60 mean values so how can i do that using loop function please help me?
Assume 'data' is an array with your 60000 values. m = mean(reshape(data,1000,[]),1); This will give you a row vector of ...

presque 9 ans il y a | 0

Réponse apportée
Building vector with for- and if statements
Make two changes: k = 0; c = 1:1:30; for i=1:30 if mod(30,c(i))==0 k = k+1; v(k) = c(i); end...

presque 9 ans il y a | 0

Réponse apportée
i have a important question!! ( function "randfixedsum" )
I think you might prefer to use the following code rather than using randfixedsum and rounding to integers: function R = r...

presque 9 ans il y a | 1

Réponse apportée
Differentiating a symbolic function
Express your function in symbolic form and use ‘diff’.

presque 9 ans il y a | 0

Réponse apportée
HOW TO USE RANDOM and Cross paired?
Use my randfixedsum in the File Exchange at: http://www.mathworks.com/matlabcentral/fileexchange/9700-random-vectors-with-f...

presque 9 ans il y a | 0

Réponse apportée
How to create a while loop that can determine how many years do you have to invest $100000 at a compound interest of 5% per year to double your money?
Who needs a loop to do this trivial problem? We want to solve for n in the equation 100000*(1.05)^n = 200000 Rewrite i...

presque 9 ans il y a | 0

Réponse apportée
does matlab have a problem with modular integer arithmetic?
As has so often been pointed out in this forum, matlab’s “double” in everyone’s computers possesses a significand (mantissa) con...

presque 9 ans il y a | 0

Réponse apportée
How to change a formula so that it does element by element multiplication?
The purpose of the dot is to enable matlab to distinguish between different kinds of operations between elements of arrays, for ...

presque 9 ans il y a | 0

Réponse apportée
Parse Error at '>' Issue
Also you cannot use the short-circuit && on vectors, only on scalars.

presque 9 ans il y a | 0

Réponse apportée
Choose random between two option.
There should be no need to go through such a simulation. For each birth the probability that a boy is born is one-half regardle...

presque 9 ans il y a | 0

Réponse apportée
Make a numerical iteration using while loop
You need to place the computation of T_tc inside the while loop. As it stands, there will be no change to Tb after the first tr...

presque 9 ans il y a | 0

Réponse apportée
How to replicate a matlab procedure
@Andrew. You state that you are doing a Monte Carlo simulation. That is perhaps the reason why you have been unable to duplica...

presque 9 ans il y a | 0

Charger plus