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

circa 9 anni fa | 1

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

circa 9 anni fa | 1

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

circa 9 anni fa | 1

Risposto
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

circa 9 anni fa | 1

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

circa 9 anni fa | 0

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

circa 9 anni fa | 0

| accettato

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

circa 9 anni fa | 0

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

circa 9 anni fa | 1

| accettato

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

circa 9 anni fa | 0

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

circa 9 anni fa | 0

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

circa 9 anni fa | 1

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

circa 9 anni fa | 1

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

circa 9 anni fa | 1

| accettato

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

circa 9 anni fa | 0

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

circa 9 anni fa | 1

| accettato

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

circa 9 anni fa | 0

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

oltre 9 anni fa | 0

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

oltre 9 anni fa | 0

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

oltre 9 anni fa | 1

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

oltre 9 anni fa | 0

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

oltre 9 anni fa | 0

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

oltre 9 anni fa | 0

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

oltre 9 anni fa | 0

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

oltre 9 anni fa | 0

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

oltre 9 anni fa | 0

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

oltre 9 anni fa | 0

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

oltre 9 anni fa | 0

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

oltre 9 anni fa | 0

Carica altro