Answered
Solving two equations with two unknows
You could undoubtedly solve these two equations using 'solve' of the Symbolic Toolbox or 'fsolve' of the Optimization Toolbox. ...

12 years ago | 0

| accepted

Answered
Which could be the smartest way to do what this function does
n = a:b; y = double(((n>=n0)&(flag==0))|((n<=n0)&(flag~=0)));

12 years ago | 1

Answered
I have an inequality which has to be solved.
The answer to this question depends very much on the nature of the relationship between the two variables. For the sake of this...

12 years ago | 0

Answered
Using solve function in order to solve 2 equation with 2 uknowns
I think you need to include the two variables you regard as unknown as arguments in the 'solve' function. Otherwise it has no w...

12 years ago | 0

Answered
random variable with normal distribution
The Statistics Toolbox function 'normcdf' is just what you need.

12 years ago | 0

Answered
Plot parabola with start, end and vertex points
Another way to get the parabola is to write: y = 0.73-a*(x-1.031)^2 which is the form it must have to peak at (1.031,0,73...

12 years ago | 0

| accepted

Answered
problem in symbolic matrix multiplication
It isn't clear whether you are receiving a matlab error message or are getting erroneous results. If it is the latter the line ...

12 years ago | 0

Answered
can you help me turn this algorithm to matlab and plotting the number of earring
It looks as though you want to find the largest divisor of n less than n if n is not a prime number, and otherwise the prime num...

12 years ago | 0

| accepted

Answered
Is MATLAB giving wrong (symbolic) definite integration??
Your inner for-loop is written for j=i:1:3 with the lower value as 'i' rather that 1. This of course gives you an upper ...

12 years ago | 0

| accepted

Answered
Point that lies on the angle bisector.
R2 = norm(P2-P1); R3 = norm(P3-P1); T = (P2-P1)/R2+(P3-P1)/R3; P0 = P1+T/norm(T)*(R2+R3)/2; % <-- P0 is the desired point...

12 years ago | 0

Answered
Random integers (no permutation)
You can use matlab's 'nchoosek' function to generate your desired matrix. It will find all combinations of k=8 things out of n+...

12 years ago | 0

Answered
Please help me with the optimization
A couple of possibilities for reducing the execution time: 1) Use the 'roots' function instead of 'fzero' and select the sing...

12 years ago | 1

| accepted

Answered
Calculate the error for many time steps in the same file ( Only work for one time step )
Questionable aspects of this code: 1) In your outer for-loop you don't reset x to an initial value x = xin again for a rerun ...

12 years ago | 0

| accepted

Answered
probability of a run of k heads or more in N tosses of a fair coin N>>k
Here is an iterative method of finding the probability. Let k and N be the quantities you described. Then perform this matlab ...

12 years ago | 0

Answered
How to eliminate the for in the following function and make it vectorized, should be simple?
Your problem statement and your code are not in agreement. Presumably the line in the code's for-loop ought to be: X(i+1,1)...

12 years ago | 1

| accepted

Answered
While Loop won't work on iteration problem
Assuming that by 'log' you mean the natural logarithm and not the logarithm-base-ten, then if you define the variable w as: ...

12 years ago | 0

Answered
Change for-loop iteration inside the loop.
Matlab's for-loop is designed so that you cannot change its index, in this case, 'i', within the loop. Even though you have set...

12 years ago | 4

Answered
sum 100 from given values and limits
I propose the following unique "canonical" solution. Let 'low' and 'high' be vectors of your lower and upper range limits respe...

12 years ago | 0

| accepted

Answered
Creating a column vector by multiplying the n-1 element by the corresponding element in another vector
You don't need to use a for-loop for this problem. Let the first known element of M be 'a'. M = cumprod([a;F(2:end)]);

12 years ago | 1

| accepted

Answered
Applying Cramer's rule on an nxn matrix
The two basic operations in applying Cramer's rule are: 1) replacing the k-th column of A by b and 2) obtaining the determinant ...

12 years ago | 3

Answered
What you get with: val = [0.5./n:1./n:(n - 0.5)./n]
Provided n is a positive integer, you get the following row vector with n elements: [1/(2*n),3/(2*n),5/(2*n), ... ,(2*n-1)/(...

12 years ago | 0

Answered
How to solve for an equation using a series of variables?
By taking the cube of both sides of the fourth equation and substituting in the expressions for A, P, and R in terms of y, and t...

12 years ago | 0

Answered
Set specific standard deviation limit on randn matrix?
(Since you say 'randn' the mean will be zero and the standard deviation one.) You will have to call on 'randn' for more element...

12 years ago | 0

Answered
How to select real positive number ?
B=A(real(A)>0&imag(A)==0);

13 years ago | 4

| accepted

Answered
random numbers from custom mixture distribution
Here's another method you might consider that would allow you to directly use the 'gamrnd' and 'lognrnd' functions in the Statis...

13 years ago | 0

| accepted

Answered
Error in plotting the graph
You are attempting to use matrix power on a row vector and that is not an allowed syntax. As the error message clearly states, ...

13 years ago | 0

| accepted

Answered
form a formula to calculate the time between bounces of a ball
Is this homework? You need to work the problem in two stages. First determine the velocity of the first impact from a drop of ...

13 years ago | 0

Answered
solving complex equation in matlab
n = 1/k0/d*atan2(sqrt(1-X^2),X) and n = 1/k0/d*atan2(-sqrt(1-X^2),X) All other solutions differ from these by integra...

13 years ago | 1

Answered
Triplequad for solving integral
I don't believe the 'triplequad' function will accept limits that depend on variables. However the function 'integral3' does ac...

13 years ago | 0

| accepted

Answered
breaking an if loop
Are you sure the 'break' is not executed? You have placed it within the inner for-loop, so when it performs the break it contin...

13 years ago | 1

Load more