Answered
How to solve a coupled system of differential equations with two derivatives in one equation?
I think the easiest way would be to solve for dx/dt and then use any of the numerical ode functions: dx/dt = x/y+x-x^2 d...

11 years ago | 2

Answered
Question about using fzero to find all real roots of a polynomial
*Is it possible to display all of the real roots of this polynomial using the fzero command?* The answer to this question is ...

11 years ago | 0

Answered
got stunned and cannot display on commond during using while-loop
1. You used "(1-x./n).^n" instead of the required "(1+x/n)^n", so you can never hope to match elements of 'myVal' with those of ...

11 years ago | 2

Answered
how to calculate pdf probabilitity of i.i.d
This is apparently homework. Here's a hint to get you started. If x is the maximum of x1,x2,...,xn, the probability that x <= ...

11 years ago | 2

Answered
Three ways to do the same integration leading to three different speeds: why?
As to the difference between method 1 and 2, for each of the million trips through the loop method 2 has to construct and then a...

11 years ago | 0

Answered
how do i use for loop to fine determinant of Vandermonde matrix?
Let V be an n-by-n Vandermonde matrix. d = 1; for k = 1:n-1 d = d*prod(V(k+1:n,2)-V(k,2)); end % <-- At exit...

11 years ago | 2

| accepted

Answered
Error using round(reshape(message,Mm*Nm,1)./256)
Does 'lena.jpg' produce a third dimension for color? If so, that would account for your error message; you would have more than...

11 years ago | 1

Answered
Double & Triple Integration with tabular data
You can use Matlab's 'trapz' successively for this purpose. The easiest case is integrating over a rectangular region in (x,y) ...

11 years ago | 2

| accepted

Answered
How to give IF condition in following code?
b = true; while b yt = randi([0,1],W,1); b = (sum(yt)<2); % Repeat if 'yt' has less than two ones end ...

11 years ago | 2

| accepted

Answered
how do i find the angle between a vector and a line?
b = [2,5,8]; % vector along line ang = atan2(norm(cross(a,b)),dot(a,b)); % Angle in radians between vectors a and b (N...

11 years ago | 1

Answered
two coupled algebraic equations
Multiply each equation by x/k^2. The first equation becomes a quadratic equation in the ratio x/k and the second one becomes a ...

11 years ago | 0

Answered
Extract random sample x,y,z data inside the circle
In setting 'view' to view(5,90) which is a view from overhead and referring to cartesian coordinates, a0 and b0, at the center o...

11 years ago | 1

| accepted

Answered
error : minus matrix dimention
Hamid, your 'solveq' function is clearly intended only for an 'f' input argument consisting of a column vector, not the 3-by-n s...

11 years ago | 1

Answered
How to convert this code without 'goto' statement?
That is code you wouldn't want to use. As it stands the function has no way to exit. Regardless of the results of all the 'if'...

11 years ago | 0

Answered
Plotting a function in a range of variable
If you want to do plotting with 'alpha' in the range alpha=0:0.1:2, you should not declare 'alpha' as a symbolic variable. Inst...

11 years ago | 2

| accepted

Answered
Can anyone help me with for loops in Matlab?
Here is code for doing selection sorting, Anthony. However, as it stands it works only on a single column vector and does not i...

11 years ago | 1

| accepted

Answered
if" function in matrix elements
s = sum(G(:)<=1); if s == 1 C = A+B elseif s == 2 C = A-B else ??? What do you want to happen...

11 years ago | 2

| accepted

Answered
How to make Duplicate values
p = cumsum(accumarray(cumsum([1,Q])',1))'; R = W(p(1:end-1)); Note: If you have a zero in Q, the corresponding W value...

11 years ago | 3

| accepted

Answered
Plot y^2 = x^2 + 1 (The expression to the left of the equals sign is not a valid target for an assignment.)
You can generate this hyperbola plot using hyperbolic functions as parameters: t = linspace(-4,4,500); x = sinh(t); ...

11 years ago | 1

Answered
Generating a random variable that has a predefined covariance with other random variable
You haven't stated what you want the variance of X to be. If it is to be 1, the trivial solution would be to set X = e. For ge...

11 years ago | 3

| accepted

Answered
User-Defined Selection Sort for 2-D arrays of any size (MATLAB)
function [array2,p] = sortorder(array,col) [~,p] = sort(array(:,col)); array2 = array(p,:); return

11 years ago | 3

| accepted

Answered
Replace NaNs with next real value.
Here's another way: t = isnan(x); f1 = find(t); f2 = find(diff([t,false])==-1)+1; f3 = zeros(1,length(f1)); ...

11 years ago | 0

Answered
How to solve an equation with piecewise defined function?
Instead of using 'solve' you can use 'fzero' for this problem. Of course this problem is so simple you can do it in your head, ...

11 years ago | 2

Answered
hi, i need your help, y''=xy, y(0)=0 and y(0)=1 this second order DE i can solve in power series method i got recurrence relation
I don't agree with your recurrence equation, Jamila. For the series I get: y = x + x^4/(3*4) + x*7/(3*4*6*7) + x10/(3*4*6*...

11 years ago | 1

Answered
can i integrate this function using integral?
You haven't shown us your code for using the 'integral' function, but your code for using 'trapz' has the right integrand functi...

11 years ago | 1

Answered
Find s, such that det(A+s*D) = d.
If d is real and only real roots are being sought for s, you can simply write a function that accepts a scalar value s and compu...

11 years ago | 0

Answered
compute the 2 dimensional (x,y) with respect to time
Let 'a' be the given vector. plot3(a(1:3:end),a(2:3:end),a(3:3:end),'r-')

11 years ago | 1

| accepted

Answered
I am having trouble finding the values for a certain variable which contains the "cosh(x)"
The function cosh(x) is defined as (exp(x)+exp(-x))/2 and therefore as x increases in size, the value of cosh(x) increases expon...

11 years ago | 2

| accepted

Answered
Creating a function to plot multiple column of a variable in workspace
Just use a for-loop for this purpose: for k = 1:n plot(wavelengtha(:,k), Raman); hold on end What could...

11 years ago | 1

| accepted

Load more