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

casi 9 años hace | 1

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

casi 9 años hace | 1

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

casi 9 años hace | 1

Respondida
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

casi 9 años hace | 1

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

casi 9 años hace | 0

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

casi 9 años hace | 0

| aceptada

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

casi 9 años hace | 0

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

casi 9 años hace | 1

| aceptada

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

casi 9 años hace | 0

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

casi 9 años hace | 0

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

casi 9 años hace | 1

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

casi 9 años hace | 1

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

casi 9 años hace | 1

| aceptada

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

casi 9 años hace | 0

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

casi 9 años hace | 1

| aceptada

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

casi 9 años hace | 0

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

casi 9 años hace | 0

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

casi 9 años hace | 0

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

casi 9 años hace | 1

Respondida
Differentiating a symbolic function
Express your function in symbolic form and use ‘diff’.

casi 9 años hace | 0

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

casi 9 años hace | 0

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

casi 9 años hace | 0

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

casi 9 años hace | 0

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

casi 9 años hace | 0

Respondida
Parse Error at '>' Issue
Also you cannot use the short-circuit && on vectors, only on scalars.

casi 9 años hace | 0

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

casi 9 años hace | 0

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

casi 9 años hace | 0

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

casi 9 años hace | 0

Cargar más