Answered
How to sum a specific number of observations through an entire dataset
Use cumsum. If your "log returns" are called 'LR', do this: c = cumsum(LR); s = c(n+1:15)-c(1:15-n); For n = 10 that wo...

13 years ago | 0

| accepted

Answered
CDF of exponential power distribution
Matlab's gammainc normalizes the incomplete gamma function by dividing by gamma(1/beta). See its documentation. The Wikipedi...

13 years ago | 0

| accepted

Answered
how to solve the below non linear algebraic equation using matlab
You can perhaps get more insight into the solution of your equations if you proceed along lines such as the following. For conv...

13 years ago | 0

Answered
Proper use of the Secant method
Your code is not carrying out the secant method properly, Harold, but rather than my engaging in a prolonged discourse on how to...

13 years ago | 0

Answered
Adding values to 3d matrix
There is a way around for-loops using 'sub2ind'. M = zeros(16,16,16); M(sub2ind(size(M),x,y,z)) = values; Roger Staffor...

13 years ago | 2

Answered
how to use circshiftfor each column of a matrix
If you want a solution without for-loops, try this. Let A be your matrix and S be a row vector of various positive or negative ...

13 years ago | 0

Answered
The sum of stacked matrices
sum(A,3) Roger Stafford

13 years ago | 0

| accepted

Answered
how to find the sharp turn in a 2d-line (curve)?
One measure of a "sharp turn" is the amount of curvature between three adjacent points on your curve. Let (x1,y1), (x2,y2), and...

13 years ago | 2

| accepted

Answered
Simple rounding numbers in a matrix
b = (a>.5)-(a<-.5); Roger Stafford

13 years ago | 2

Answered
How to solve non linear equations with three variables? I tried matlab codes available in www.mathworks.in. and also I tried Newton rapson method .But I could not get proper output.Please help me to solve this.
There is a very good reason why those three equations present a difficulty. If the left sides of the first two equations are ad...

13 years ago | 1

Answered
Random Numbers within specified range in specific ratio
You haven't specified whether you want the density to be constant within each of these subintervals or be a continuous functio...

13 years ago | 0

Answered
Odd Numerical Issue - Can I select a Processor Type?
Your results are surprising to me, Andrew. Are you consistently using double precision for all quantities involved? If so, it ...

13 years ago | 0

Answered
Can anyone help me solve this coin toss problem. I am a beginner
As indicated by Image Analyst you had errors in your code. The most important error was writing e = a./b rather than e = c./d ....

13 years ago | 0

| accepted

Answered
??? Subscript indices must either be real positive integers or logicals.
In the definition "t_1a = t_1(find(t_1 < buf_dur));" you have ensured that no index in 't_1b' could exceed 'fs' which is the len...

13 years ago | 0

Answered
Estimating the value of pi using a summation through creation of an m.file by using a loop.
Adam, your while-within-a-while construct is certainly not going to work for you. The terms "4*(-1).^n/(2*n+1)" are supposed ...

13 years ago | 0

| accepted

Answered
if statement didn't executed in a loop
Shawn, look at the third line from the beginning of the for-loop: if(time(i) ~= off_tt) It is an outer condition that m...

13 years ago | 0

Answered
Nested Numerical Integral in Matlab
The functions 'dbsquad' and 'quad2d' are designed to numerically solve just your kind of problem. The former uses the the kind ...

13 years ago | 0

Answered
Finding Joint Angle from Motion Capture
At any time, let H = [x,y,z], N = [x,y,z], S = [x,y,z] be coordinate vectors of the head, neck, and shoulder markers at that t...

13 years ago | 2

| accepted

Answered
How can I use the MATLAB vector processing instead of this for loop?
As your code is now, you are performing 280,000 X 1,200 = 336,000,000 additions. You can cut down the number of flops by a fa...

13 years ago | 0

Answered
How to sort the matrix quickly?
The following should be a much faster way of sorting V and DD by the absolute values of the eigenvalues in DD: [V,DD] = ei...

13 years ago | 0

Answered
Predefined variables k, z? Ans Help
The expression in your 'Func' is identically equal to 3/100*(6*cos(x/a)^3+18*cos(x/a)^2+17*cos(x/a)+3)/(1+cos(x/a))^3 a...

13 years ago | 1

Problem


Sum the Infinite Series II
For any x in the range 0 < x and x < 2*pi radians, find the sum of the following infinite series: c = 1 + 1/2*cos(x) + 1/2*3...

14 years ago | 1 | 22 solvers

Problem


Sum the Infinite Series
Given that 0 < x and x < 2*pi where x is in radians, write a function [c,s] = infinite_series(x); that returns with the...

14 years ago | 10 | 151 solvers

Solved


Nonuniform quantizer as a piecewise constant function
Implement a nonuniform quantizer as the following piecewise function: y = -3.5, x < 3 y = -1.5, -3 &#8804; x < -1 y = -...

14 years ago

Solved


Mechanics 1
I thought I would make a mechanics problem for all those physics lovers out there. Imagine two solid, rigid spheres B1 and B...

14 years ago

Problem


Compute Area from Fixed Sum Cumulative Probability
In Matlab the code v = rand(1,3); v = v/sum(v); is sometimes suggested as a convenient means of generating three rando...

14 years ago | 1 | 7 solvers

Solved


Triangle Numbers Below N
This is an offshoot of <http://www.mathworks.com/matlabcentral/cody/problems/5-triangle-numbers Cody Problem 5: Triangle Numbers...

14 years ago

Solved


How to find the position of an element in a vector without using the find function
Write a function posX=findPosition(x,y) where x is a vector and y is the number that you are searching for. Examples: fin...

14 years ago

Solved


Project Euler: Problem 1, Multiples of 3 and 5
If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23...

14 years ago

Solved


chance in percent for minimum K heads when a good coin is tossed N times?
For example, chance is 100% for minimum 0 heads when a coin is tossed 7 times. Chance is 50% for minimum 2 heads when a coin is...

14 years ago

Load more