Can someone help with this?

Hi I need help plotting the resopnse to this differential equation with 10^4 points. thanks if you can help.
!x!+ cx! + kx + εx3 = Bcost
0 c ≤ 0.5, 1 k ≤1, 0 ≤ ε ≤1, B = 8.5 ignore the exclamation points.

3 Comments

Is "εx3" ε*x3 or ε*x^3 ?
If we are to ignore the exclamation marks, then this seems to be
(1 + c + k) * x + ε*x^3 = B*cost
which is not a differential equation.
the form you wrote it in is correct it is ε*x^3.
Is it correct then that the equation is
(1 + c + k) * x + ε*x^3 = B*cost
? If so then what do you mean by "response"? This is not an differential equation.

Sign in to comment.

 Accepted Answer

The equation
(1 + c + k) * x + ε*x^3 = B*cost
can be solved using roots()
roots([epsilon, 0, (1 + c + k), -B*cost])
You then have a plot with three independent variables, c, k, epsilon, together with 3 results per location; 0, 1, or 3 of the results will be real-valued. Plotting this will require a 4 dimensional plot: 3 axes plus 1 result. You need to decide how you want to represent the 4th dimension: options include "color", "marker size", and "transparency".
On the other hand, (c+k) is linear, and the only information that it gives beyond the range (min(c)+min(k)) to (max(c)+max(k)) is in the density of the points. So you might as well drop down a dimension in the plotting
N = 100;
[EPSILON, CK1] = ndgrid(linspace(0,1,N), linspace(1 + 0 + -1, 1 + 1/2 + 1, N));
X = roots([EPSILON, 0, CK1, -B*cost]);
surf(EPSILON, CK1, X(:,:,1)); same for (:,:,2) and (:,:,3) for the three different X values
or something similar (I have not checked the exact dimensions that X will come out as)

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!