Answered
What is my error in for loop to find the cumulative sum?
To be safe, you need to set 'cumulativesum' to zero before starting in that for-loop. It might have some other value than zero ...

12 years ago | 1

Answered
truncate and floating-points
Yes, it can be "fixed" to accomplish that.

12 years ago | 1

Answered
Distance between two aircraft
Christopher, you have made a wrong assumption. These planes will _not_ arrive at the destination point at the same time. By th...

12 years ago | 0

| accepted

Answered
Calculation of cosh, sinh big numbers
All three quantities, cosh(1399.0*t), sinh(1399.0*t), and exp(1500.0*t), will fall far beyond the realmax limit. I would sugges...

12 years ago | 3

| accepted

Answered
How to sum only the positive elements in a series?
Sultan, I think you are interpreting your instructions incorrectly. It says, "calculate only the positive elements of a series ...

12 years ago | 1

| accepted

Answered
huffmandict() The sum of elements of the probability vector must be 1
I see two possibilities here. Either 1) there is some discrepancy between the 'totalCharz' value and the actual sum of 'countMa...

12 years ago | 0

| accepted

Answered
Finding standard deviation/ error distribution of 3D points
Use matlab's 'mean' and 'std' functions. See their documentations.

12 years ago | 0

Answered
what is the differance betwwen two integral mentioned below.
If a numerical integration is carried out on this integral, it will easily be seen that the first answer is correct and the seco...

12 years ago | 0

Answered
Find length of contiguous numbers in a vector that sum to a given value
Swisslog, it seems to me you have overlooked the importance of the following very significant aspect of your problem: " *There a...

12 years ago | 2

Answered
How to count the number of consecutive numbers of the same value in an array
Here's a slightly different way: x = [2 2 5 5 5 6 6 6 6 4 7 2 2 2]; n = size(x,2); f = find([true,diff(x)~=0,true]); ...

12 years ago | 0

Answered
Create matrix with {0,1,-1} with cumsum constraints, specific sum and number for [1] and [-1]
You asked this same question earlier on Feb 19 at: <http://www.mathworks.com/matlabcentral/newsreader/view_thread/334228> ...

12 years ago | 0

Answered
Error Msg: Subscript indices must either be real positive integers or logicals
Your problem is caused by the fact that not all values of i will be exact integers, and that is due to the round-off errors in r...

12 years ago | 1

| accepted

Answered
Integration in 2D (area) using the Monte Carlo method
Using a Monte Carlo method to solve an area like this would be a terrible method to use on that problem, either requiring huge n...

12 years ago | 3

| accepted

Answered
How to stop MATLAB from rounding extremely small values to 0?
The very purpose of floating point numbers is to allow quantities to be represented which are very small or very large. Such nu...

12 years ago | 0

Answered
Delete last n1,n2,n3 (...) elements in each row in a Matrix in an efficient way or set to zero
[m,n] = size(A); p = cumsum(accumarray([(1:m)',n+1-B'],1,[m,n+1]),2); A(p(:,1:n)==1) = 0;

12 years ago | 0

| accepted

Answered
Create matrix from two arrays using colon
Assuming 1) you want integer values in your matrix, 2) the two vectors have integers, and 3) that corresponding elements in the ...

12 years ago | 0

Answered
Testing for statistical independence of two vectors
It is a frequent mistake to assume that uncorrelated random variables must be independent. Actually that is true only if the ra...

12 years ago | 2

Answered
Find a series of consecutive numbers in a vector
v = [1 2 3 6 7 9 10 50 60]; x = v([true,diff(v)~=1]);

12 years ago | 0

| accepted

Answered
Is there any way to assign a value to the diagonals of a matrix (not just the main diagonal)?
It depends on which side you call the "first" diagonal. If you use the order sense of matlab's 'diag' function, the diagonal nu...

12 years ago | 0

Answered
How can I get a matrix to store all of the for loop results?
A more compact way: s = Xmult/DataRate; t = s:s:s*TotalPts;

12 years ago | 0

Answered
Finding Set Of Answers For ONE Equation Involving SEVERAL Unknown Variables In a Discrete Data Zone
The line "F=9.*x+7.*y-60;" should be replaced by: F=9.*X+7.*Y-60; The way you had it, it only inspected the 16 pairs (-5,...

12 years ago | 1

| accepted

Answered
Triangle plotting help, area, perimeter
Hint: Once you have solved the first part, go here to see one way to solve 2.: http://mathworld.wolfram.com/HeronsFormula.ht...

12 years ago | 0

Answered
Summation Problem Please Help!!!
Believe it or not, the following code will compute your H, and in fact is probably more accurate than using factorials. It uses...

12 years ago | 0

Answered
How to calculate determinant in PCA?
To say "calculate the eigen value we have to calculate the determinant of the matrix which all the (diagonal value - lamda)" is ...

12 years ago | 0

Answered
How can I draw this ellipse on MatLab
It's easiest to generate an ellipse parametrically. I deduce from your equation for y that the ellipse's equation is: (x-4)...

12 years ago | 3

| accepted

Answered
how to execute the algorithmic operations like summation, cross etc. in matlab?
The only one that makes sense to me is that it signifies dot (inner, scalar) product. If the 'x' symbol was supposed to represen...

12 years ago | 0

| accepted

Answered
How to plot a complex exponential equation
You could use matlab's 'surf' function to do a 3D plot of either the real or the imaginary part of H, but not both at the same t...

12 years ago | 0

| accepted

Answered
Summation Evaluation - For incremental Loop Parametres
As nearly as I can make out, you are describing the cumulative sum of a matrix product, namely Value = cumsum(X*D.'); You...

12 years ago | 0

Answered
help me on plotting of curl
In your description, Rizwana, you haven't made it clear what components of velocity the variables u, v, and w represent. Appare...

12 years ago | 0

Answered
Optimization with known second-order function
This particular example is not a well-posed problem. If the parameter x3 is nonzero, there is no minimum value for y. By decre...

12 years ago | 1

| accepted

Load more