Ask the MATLAB master to help me change the program, mine has a mistake, like drawing three curves

Updated on society 2024-04-02
5 answers
  1. Anonymous users2024-02-07

    Your program doesn't work well, I wrote one myself.

    First of all, please copy the following ** into an m-file and store it as:

    function dx=dxdt(t,x)dx(1)=;

    dx(2)=;

    dx(3)=;

    dx=dx(:)

    Then enter the following command into another m-file or command window and run:

    clear;

    clc;t=[0,200];

    x0=[999999;1;0];

    t,x]=ode45('dxdt',t,x0);

    plot(t,x(:,1),'r',t,x(:,2),'g',t,x(:,3),'b');

    xlabel('t');ylabel('x');The axes explain themselves plus.

    title('myhelp');The title explains itself plus.

    legend('x1','x2','x3'%** can be added by yourself.

    I won't post the result map, and the provincial one will be pulled to review again.

    If you don't understand, you can ask, and if you think it's okay, give one.

  2. Anonymous users2024-02-06

    Something went wrong with the system, didn't I solve this problem for you? Why do you keep reminding me that I've received this request for help from you?

    The one upstairs used is my answer, and it is not even marked as a quotation!

    Original reference address.

  3. Anonymous users2024-02-05

    Why is the running result of this matlab program given by the subject a straight line? Is it wrong? Since the subject gives the equation of state of the Lorenz model, we know that the equation is completely dependent on the time tspan condition, that is, tspan=0 t, when t is smaller, a straight line will appear, but as t increases, its graph will appear in the phase space graph given by the subject (butterfly graph).

    Analyzing the subject's **, the main mistakes are:

    1. The t value is small, it is recommended to take t=100 or more

    [t,x] =rk4@(t,x)func(t,x),x0,h,a,b)

    Here, func is the custom differential equation function, x0 is the initial condition, a is the initial time, b is the end time, and h is the step size

    x0=[1,2,3]

    a=0

    b=100

    h=

  4. Anonymous users2024-02-04

    Multiple Questions:

    1. The third parameter of the linspace function is not the step size, but the number of data points.

    2. To draw a surface diagram, you need to generate mesh data, and you need to use meshgrid;

    3. The last division sign to calculate z should be the point division (

    x=linspace(0,,20);

    y=linspace(0,2,20);

    x,y]=meshgrid(x,y);

    z=20/3*pi*cos(20/3*pi*x)-10/3*sin(20/3*x)./sqrt(y.^2-cos(20/3*x));

    But there is still a problem with this: the calculated z is a complex number, and it should be that the value range of x or y is inappropriate.

  5. Anonymous users2024-02-03

    Mistake 1: Loop error, two for only one end

    Mistake 2: Replace hold on with hold on

    Error 3: Calculate y(yy,zz)=y; , the component of y should be changed cyclically, modified as follows:

    p=;v=;u=;g=;r=;n=10;

    b=p.*(1-r)./1-(1-p).*1-r));

    yy=1;for q=;

    zz=1;for v=;

    c=p.*(1-q).*1-u)./1-p).*q+(1-p).*1-q).*u);

    f=p.*(1-q)./1-p).*q+(1-p).*1-q).*u);

    a=1./(2.*(1-p).

    1-q).*v+(1-p).*q).

    g./(1-g)+(1-p).*q+(1-p).

    1-q).*v+p.*(1-q).

    1-v)-sqrt((g./(1-g)+(1-p).*q+(1-p).

    1-q).*v+p.*(1-q).

    1-v)).2-4.*(1-p).

    1-q).*v+(1-p).*q).

    p.*(1-q).*1-v)))

    e=a.*g./(1-g).*1-(1-p).*1-r)))

    d=((1-q).*u+q).*f+r).*e./(q+(1-q).*u).*1-a));

    h2=(d.*(b-a)-e.*f)./1-c).*1-a).*b-a));

    h3=e.*f.*b./(a.*(1-b).*1-c).*b-a));

    h=1./(1-a).*c-b)).

    e.*f+d.*(c-b)).

    1-c)-e.*f./(1-b))+e.

    f./(a.*(1-b).

    1-c))+d+g./(1-g).*1-p).

    q+(1-p).*1-q).*u)).

    1-c.^n)./1-c).

    2;y=c./(1-c)+h2./(h.*(1-a))+h3./(h.*(1-b));

    y(yy,zz)=y;

    zz=zz+1;% Put the zz change in the inner loop.

    end% inner loop ends.

    yy=yy+1;

    endq=;

    v=;[m,n]=meshgrid(q,v);

    hold on

    grid on

    mesh(m,n,y);

Related questions
8 answers2024-04-02

The result of my run is: beq =

ub =optimization = >>>More

12 answers2024-04-02

Changle, Chu Han, Jingting, Xiangna, Daimei, Jiana, Tiancha, Yuqing, Lixue, Shuyan, Xiaoran, Naia, Nian, Xishu. >>>More

8 answers2024-04-02

E Assignment: Net assets per share.

f Assignment: Main revenue. >>>More

7 answers2024-04-02

Out of the circle problem, this question is more classic, but at the same time slow and difficult, I have seen an algorithm, but the efficiency is not very high, and I haven't come up with it myself. >>>More

5 answers2024-04-02

You switch to the latest version 9 software.