Réponse apportée
Accelerate Matlab calculation for multi-dimension matrix
As you have written your code, A is a 2D array and yet you have taken four successive sums, which makes no sense. Either you me...

environ 10 ans il y a | 0

Réponse apportée
How to select the particular value and store ias a variable?
r = rand; t1 = (y>=r); t2 = (y<=r); if any(t1) [~,i1] = min(y(t1)); if any(t2) [~,i2] = max(y...

environ 10 ans il y a | 0

Réponse apportée
Can't find the MATLAB error
There should be a comma between \n' and max(waketime(:)).

environ 10 ans il y a | 0

| A accepté

Réponse apportée
Image pixels value exceeds 0-255 range, after arithmetic operations on image - How to solve it
I would suggest normalizing the matrix: I = double(I).^3; I = floor(I/max(I(:)));

environ 10 ans il y a | 0

Réponse apportée
decimal to fraction conversion
The 'rat' function returns with an output in the form of continued fractions. To see it as a single fraction, use "format rat"....

environ 10 ans il y a | 5

Réponse apportée
How can I use the multidimensional index returned by max or min?
There is a fairly obvious method using nested for-loops, so I assume you are looking for a vectorized method. I am not at all s...

environ 10 ans il y a | 0

Réponse apportée
How to generate vector of n random numbers between 0 and 1 to x decimal places?
You might be interested in the function I wrote for the File Exchange: http://www.mathworks.com/matlabcentral/fileexchange/9...

environ 10 ans il y a | 0

Réponse apportée
Subscript indices error when plotting
This is your problem: X(i,2) = Cv; Y(i,2) = SWR; Matlab is objecting to the fact that 'i' is being used as an index...

environ 10 ans il y a | 1

| A accepté

Réponse apportée
Euclidean Distance (Back to the Math...complete with two loops)
Apparently what you want is this: for l = 1:3 for m = 1:3 C(l,m) = sum((A(l,:)-B(m,:)).^2); end end This ...

environ 10 ans il y a | 2

| A accepté

Réponse apportée
Inaccuracy in obtaining the Absorption coefficient
In your expression for 'fa' you need to use dots in the division operations on vectors: fa = (((0.11*(xa))./(1+(xa))) + ((4...

environ 10 ans il y a | 0

| A accepté

Réponse apportée
Find the best combination of each pair of entries in a matrix
The number of possible bijections for an n-by-n matrix, M, would be n factorial. Use 'perms' to generate all possible permutati...

environ 10 ans il y a | 0

| A accepté

Réponse apportée
What is the difference between these two scripts; and which one is more appropriate to use
In "u = squeeze(tdata(1,:,:)./10);" the first level of the first dimension of three-dimensional 'tdata' is divided by 10 and con...

environ 10 ans il y a | 0

Réponse apportée
removing zeros from matrix
A = A.'; A = reshape(A(A~=0),3,4).';

environ 10 ans il y a | 0

| A accepté

Réponse apportée
Streamlining Code for Efficiency
TotalNew = bsxfun(@times,(y(:,1)+y(:,2)<=1)&(y(:,2)==y(:,6))&(1-y(:,3)+y(:,1)+y(:,2)>=1),y);

environ 10 ans il y a | 0

| A accepté

Réponse apportée
age matching between two groups
There is a very crude brute force method, but it is only practical for a limited range of sizes of the two groups. I suppose fi...

environ 10 ans il y a | 1

| A accepté

Réponse apportée
How can I compare two traces in a more efficient way?
See if 'pdist2' would be any faster: A(:,5) = min(pdist2(A(:,1:2),B(:,1:2),'squaredeuclidean'),[],2);

environ 10 ans il y a | 0

Réponse apportée
overlapping area between two circles
Let the distance between the centers of two circles be d and their two radii be r1 and r2. Then the area, A, of the overlap reg...

environ 10 ans il y a | 1

Réponse apportée
How to convert this c code in to matlab.
In the first place, the arrays X13, X14, and X16 will have to be changed to start at index 1, not 0. Matlab does not allow an i...

environ 10 ans il y a | 1

Réponse apportée
Using integral3 to calculate the conditional expectation of an RV
Since you are computing the conditional expected value, you need to divide your integral by the probability of satisfying X>Y & ...

environ 10 ans il y a | 2

Réponse apportée
How to calculate round off error in each step of finite central difference approximation.
The lines e1(i) = f(x-h)-round(f(x-h)); e2(i) = f(x+h)-round(f(x+h)); Roundoff(i) = abs((e2(i)-e1(i))/(2*h)); do ...

environ 10 ans il y a | 0

Réponse apportée
Error using bitxor Matrix dimensions must agree. key1=bitxor(a,b);and key=imresize(key1,[1 256])
As you have written the code, the numbers of elements in 'a' and in 'b' depend on how many bits are required to represent 'sud1'...

environ 10 ans il y a | 0

| A accepté

Réponse apportée
how to obtain all combinations of n numbers for following condition
The problem posed in the 'Answer' request below is equivalent to your question with three baskets. The different numbers can be...

environ 10 ans il y a | 1

Réponse apportée
How to integrate x*f(x) in Matlab? f(x) is normal distribution density function.
With f(x) of the form K*exp(-(x-m)^2/(2*s^2)), you can write x*f(x) = m*f(x) + (x-m)*f(x) The integral of the first of th...

environ 10 ans il y a | 0

Réponse apportée
surface area of a 3D surface
If you know the 3D coordinates of each of the three vertices for each triangle in your diagram, then just take the sum of all th...

environ 10 ans il y a | 3

| A accepté

Réponse apportée
I'm trying to find what do I need to add to the negative values to get the correct DeltaT? I also need to find where they are negative.
It's as the error message states. You went one too far in 'Min'. Apparently there are 337678 elements in 'Data.min' and in 'Da...

environ 10 ans il y a | 0

Réponse apportée
I have one matrix 5X5 at MatLab, and, for each line, I need to select one random value of one column of that matrix. How can I do that without repeat columns?
I assume by 'line' you mean 'row', and that you want a random column selected in each row without a duplication of columns. Le...

environ 10 ans il y a | 0

Réponse apportée
How to sort vectors so every 1 entry is collected and followed by every 2 entry until the nth entry
s = reshape([a;b;c;...;m],1,[]);

environ 10 ans il y a | 0

| A accepté

Réponse apportée
Precision issues when checking for a whole number
Actually x>=0 and either round(x)==x, floor(x)==x, or ceil(x)==x are always valid tests for whether x is a whole number *as stor...

environ 10 ans il y a | 0

Charger plus