Answered
can any one help me in detecting an error in matlab code please ?
The error message is telling you what is wrong. In this case the expression within the larger expression for finding g fa...

11 years ago | 0

| accepted

Answered
How can i create an if-function with probability p ?
if rand<=p y = 2*x; else y = 5*x; end

11 years ago | 1

Answered
how Can I have a stable and converged solution using fsolve?
_"when I change the initial guess my solution (Hw) changes"_ This is a feature of 'fsolve' you will have to accept, Parham. It...

11 years ago | 0

Answered
sum of random matrix = to zero
As was pointed out in your previous query, "sum of all anges is zero", one solution is to use 'randfixedsum' in the file exchang...

11 years ago | 1

Answered
Understanding accelerometers for rotational motion data
I assume your accelerometer is mounted such that it rotates along with the rotation of the rod. If so, the only significant com...

11 years ago | 2

| accepted

Answered
For loop invalid syntax problem, very frustrating.
Put an asterisk between the 0.032 and the 't': Htheo(t)=4*(1-exp(-0.032*t))

11 years ago | 2

Answered
Why does integral2 function changes the array size of variable over which integration is performed?
Where you say _"While integrating the size of s and t is taken as 45x1 but sometimes it becomes 30x1"_ , you are apparently refe...

11 years ago | 0

Answered
Unique triples: Length of wire bent into triangle
The question is asking you to start with just a given integer, L, and find integers a, b, and c which are the lengths of a right...

11 years ago | 0

Answered
Solve a function in terms of a variable?
If my memory serves me correctly, that function will give rise to elliptic integrals of the first and second kinds, incomplete. ...

11 years ago | 0

Answered
Vectorizing/speeding up bsxfun multiplication-loop
You can try these to see which, if either, is faster than your current method: C = reshape(reshape(A(:,:,31:end),[],2221)*...

11 years ago | 1

| accepted

Answered
vector multiplication and dot product
You cannot have the grouping q = [(1 2 3) (1 2 3); (1 2 3) .... for ordinary matrices, but you can do this: [1 2 3 1 2 3;1...

11 years ago | 0

| accepted

Answered
Exponential Function without exp() function
You have done two things incorrectly here, Karen. First, your required loop was to be unbounded and yet you placed a bound of f...

11 years ago | 0

Answered
Output of symoblic expression coming out incorrectly
The two expressions are identically equal for the cosine function, just as t*w and w*t are identically equal because of the comm...

11 years ago | 0

| accepted

Answered
Hi, I tried to solve the below equation(roots of w) in Matlab but it gave me no explicit solution. Please help to explain it.
I believe you have an eighth degree polynomial in w with only even powers, so it can be regarded as a fourth degree polynomial i...

11 years ago | 0

Answered
how to make a Series?
x = zeros(N,1); for n = 1:N x(n) = sum(-(sqrt(n:-1:2)-sqrt(n-1:-1:1)).*x(1:n-1))+1/(+exp(-a*n)); end

11 years ago | 0

| accepted

Answered
How can I apply 'for' cycle for two arrays?
It depends on what you mean by "For each value of Jw and mu_o". If you mean for each of eight corresponding pairs of numbers fr...

11 years ago | 0

| accepted

Answered
help with preallocating arrays?
myArray = zeros(1,10); for k = 1:10 myArray(k) = k+1; end or better still: myArray = 2:11;

11 years ago | 1

Answered
how can I use my function on 3*3 blocks?
m = M(a:a+2,b:b+2); % This is your "block" t = +any(m(:)~=0); % This is the returned value

11 years ago | 0

Answered
[HELP] Vector loops :'(
You have set std1 and std2 to equal values. Provided you do that, the result in 'h' is independent of the value 'c' and can be ...

11 years ago | 2

| accepted

Answered
Iterative Loop for value convergence
Three pieces of advice: 1) Put Wrd = Wrdnew and Wfd = Wfdnew at the beginning of your while-loop and remove Wrd = Wrdt/2 and ...

11 years ago | 0

Answered
fsolve to find circle intersections
In case you are interested, there is a much more direct way of finding the two intersection points of two circles than using 'fs...

11 years ago | 7

Answered
numerical integration __ integral limits being variables
There are a number of ways you can proceed. One way is to use 'int' with a variable upper limit. See: http://www.mathwor...

11 years ago | 1

| accepted

Answered
Lyapunov Plotting: using 'mesh' and 'meshgrid' with matricies
To get the V you need for plot3, do this: V = sum(x.*(P*x),1); Don't do a meshgrid on e and ed for use in plot3. You we...

11 years ago | 0

Answered
How do I create a (n x n) matrix whose elements alternate 1 or 0?
M = toeplitz(mod(1:n,2),mod(1:n,2));

11 years ago | 1

Answered
How to generate a no. of permutations(lets say 100) of a particular row of a matrix(consisting of 30 coloumns) and store the generated permutation into another array row wise??
If r is the 30-element row vector being used, do this: m = 100; n = 30; [~,p] = sort(rand(m,n),2); s = reshape...

11 years ago | 0

| accepted

Answered
Warning: Explicit integral could not be found in matlab
You should try the 'simplify' function on 'e' before trying to integrate it. You will be surprised how much simplification is p...

11 years ago | 0

Answered
How to extract length along an angle that intercepts an ellipse.
You apparently have the center of your ellipse located at the coordinate origin. If [px,py] is the endpoint of one principal ax...

11 years ago | 1

| accepted

Answered
Need help creating an array
Do either of these two: n = 10; % <-- you choose n A = diag(-4*ones(n,1))+diag(2*ones(n-1,1),1)+diag(2*ones(n-1,1),-1)...

11 years ago | 1

| accepted

Answered
Fibonacci program makes matlab go busy forever
You can also compute the n-th term in the Fibonacci series with this formula: f(n) = round((((1+sqrt(5))/2)^n-((1-sqrt(5))...

11 years ago | 3

Answered
how to compute running correlation coefficient
By _"running correlation coefficient"_ I assume you mean you want the correlation computed for each possible length of x and y f...

11 years ago | 0

Load more