MATLAB: Can someone help with this

differential equations

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.

Best 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)