matlab期末作业(matlab期末作业)
mat lab期末作业(matlab期末作业) The final assignments are as follows 1. solving differential equations, drawing the solution function diagram. Five 0 One 0 Three Three Y Y X Y 0t30 2. A set of sparse data is generated, and the data are interpolated by one dimension interpolation The theoretical curves are compared and the corresponding curves are drawn. T E T T Y TCOS Two 3 3 a factory produces two kinds of beverages, 6 kg per 100 boxes of beverage and 10 workers Profit of 100 thousand yuan; per hundred boxes of B drinks need 5 kilograms of raw materials, 20 workers, 90 thousand yuan profit. This work The factory has a total of 60 kilograms of raw materials, 150 workers, and due to other conditions, a beverage production is not more than 800 boxes. Ask how to arrange the production plan, that is, how much the two drinks produce to make the most profit. Further discussion 1 if we invest 8 thousand yuan, we can increase the raw material by 1 kg, and ask if we should make the investment. 2 if the profit per 100 boxes of beverage can increase by 10 thousand yuan, should we change the production plan. One 1. solving differential equations, drawing the solution function diagram. Five 0 One Three Three Y Y X Y X Y X X 0t30 The answer is as follows Converting the upper to Three One One Two One Three Two One Two Two 0 One 0 0t30 Writing M files Function y myodefun T, x Y[-x 1 3-x 2 X 1 -x 2 ”3]; End Enter in the command window Tspan[0, 30]; x0[l; 0. 5]; [t, x] ode45 myodefun, tspan, xO 〃Plot〃T, X l,g*‘,t, X ⑵, The output graph is as follows Zero Five Ten Fifteen Twenty Twenty-five Thirty -0. 5 Zero Zero point five One 2. A set of sparse data is generated, and the data are interpolated by one dimension interpolation T E T T Y TCOS Two 3 Two The theoretical curves are compared and the corresponding curves are drawn. Make a function first Take 0, 0. 5, 1, . . . 9. 5, 10, take a value every 0. 5, and make a scatter plot. T E T T Y Two 3 Secondly, the scatter points are linear linear, three degree polynomial cubic and spline interpolation respectively. T00.510; Yt. ”3. *exp -2*t.*cos t Xl-0. 2510; Ylinterpl T, y, xl, liner,; Plot T, y, r*, xl, Yl,b; Legend scatter point , linear interpolation; Zero One Two Three Four Five Six Seven Eight Nine Ten -0. 1 -0. 08 -0. 06 -0. 04 -0. 02 Zero Zero point zero two Zero point zero six Zero point zero eight Scatter linear interpolation T00. 510; Yt. ”3. *exp -2*t.*cos t X0. 2510; Ylinterpl T, y, xl, cubic; Plot T, y, r*, xl, Yl,b; Legend scatter point , three polynomial interpolation ; Three Zero One Two Three Four Five Six Seven