Answered
how to bypass my complex values inside objective functions? bounds and constraints not working…
I would suggest that in computing your objective function, you yourself apply the constraint of non-negativity to the expression...

11 years ago | 0

Answered
How to find the maximum value of the output values from a FOR loop
You can do it this way: maxA = -inf; for t=99:0.01:100 sim('massspringdamper') ys=interp1(t,x,t); ...

11 years ago | 1

| accepted

Answered
Using cov to find a covariance matrix
If you consult the documentation of 'cov' at http://www.mathworks.com/help/matlab/ref/cov.html you will see that it say...

11 years ago | 2

| accepted

Answered
Help in integrating an expression
If 'int' is unable to integrate your function, you may have to resign yourself to using numerical integration for which you woul...

11 years ago | 1

| accepted

Answered
How to enter this program?
You need to translate each of those conditions into a matlab logical proposition. For example if n is an integer you are invest...

11 years ago | 1

| accepted

Answered
How to find the roots of a derivative
Rather than tell you what is wrong with your method, I prefer to tell you how I think you should approach the problem. The deri...

11 years ago | 2

Answered
Using Fzero for one variable in a nonlinear equation with multiple variables
You want a solution for r as an explicit function of a, b, dh, and de. You cannot accomplish that with 'fzero' or any of the fu...

11 years ago | 2

| accepted

Answered
Constructing matrix elements conditionally (and sequentially)
C = zeros(size(A)); C(A>0) = B; (Note that this will give an error if your assumption that sum(A)==length(B) is not tr...

11 years ago | 1

| accepted

Answered
How to integrate using while loop?
Strictly speaking, this is an answer to a question you haven't asked, Andrejus, but I thought you might be interested in the fac...

11 years ago | 1

Answered
How to compare the first column of the rows to whole matrix?
C = sum(bsxfun(@eq,A(:,1),A),2)-1; % <-- Counts (not counting column 1)

11 years ago | 2

Answered
How to integrate using while loop?
In order to show that your problem need not involve time-consuming iterative methods here is the complete solution in four lines...

11 years ago | 2

Answered
How to find co-ordinates of a point in 3D using Matlab functions?
This problem is equivalent to finding the common points of intersection of three spheres. You should realize that if there are ...

11 years ago | 2

Answered
fprintf Displays the wrong value
You are assigning y string values, not numerical values, but you are displaying them using 'fprintf' for numerical values (%1.2f...

11 years ago | 1

Answered
Pulling data from text file and the results are being shown as NaN
I see places in your code that could produce NaNs. In the section sum1=0; sum2=0; for i=1:imax t=m(k,i)...

11 years ago | 2

| accepted

Answered
How to integrate using while loop?
Actually, Andrejus, if you make a change of variable from w to x according to: w = x^(-1/4), you will see that your pro...

11 years ago | 2

Answered
help me to reduce my function time runing
U = (0:99).'; V = 0:2:198; F = (10*sin(U))*cos(V)+(10*cos(U))*sin(V); imagesc(F); colormap(gray);

11 years ago | 4

| accepted

Answered
Sigma notation - two variables. 'for' loop or symsum?
Axx = x.'*hankel(x,zeros(1,N/4+1));

11 years ago | 2

Answered
[Matlab]Desperate help with a simple code.
M = randi([5,18],1000);

11 years ago | 3

| accepted

Answered
Comparing a logical matrix and a numerical matrix?
Assuming 'mask' really is a logical array the same size as 'orig' do: orig = mask.*orig+(~mask).*orig/4; Otherwise if '...

11 years ago | 2

Answered
Hot to display a variable from a row ?
Writing j=1:length(m34) makes 'j' a vector with six elements, and therefore m34(j)-mSTAS(i)<=Er is a logical v...

11 years ago | 2

Answered
Solving a nonlinear equation with random variable
Write a subfunction using matlab's function 'integral' whose input is a vector 'phi' and computes your expected value for each v...

11 years ago | 3

| accepted

Answered
how to add two matrix
Let 'a' and 'b' be two row vectors. To add zeros to the left side of the shorter one so as to have equal lengths do this: n...

11 years ago | 2

| accepted

Answered
how to xor binary vector in matrix
If I understand what you want and if the rows have a multiple of three elements, this should work for you: X = xor(xor(M(:,1...

11 years ago | 3

| accepted

Answered
solving a non-linear problem
The most recent version of your eight equations (9/11/14) in which eq. 6. had been changed was this: 1. x1/x5 = n; 2. x6*x...

11 years ago | 2

| accepted

Answered
Solving simultaneous equations numerically
It doesn't matter that your two equations involve an extended summation. You can still create a function that generates these s...

11 years ago | 4

Answered
I want to solve This transcendental Equation which contains many roots.Please help me.
I can think of two ways to proceed in finding complex roots to your equation. One way is to use 'fsolve' in the Optimization To...

11 years ago | 0

Answered
cumsum that restarts whenever it reaches certain level
I think your code only works on one column at a time. It also appears to have the disadvantage that each time your cumulative s...

11 years ago | 3

| accepted

Answered
Summation and array indexes
sum(A(:))./sum(sum(B,1),2)

11 years ago | 1

Answered
I want to solve This transcendental Equation which contains many roots.Please help me.
No, I think you are mistaken, Aman. There are only two roots, one obvious one at x = 0 and the other at x = -0.4046133685...

11 years ago | 1

Answered
Double Integral of Bivariate joint normal distribution
Using 'mvnrnd' to do double integration is an extremely poor method of integration. Just use 'integral2' on the integrand 'mvnp...

11 years ago | 1

| accepted

Load more