Paper writing --- solving equations of matlab symbolic operation

Paper writing --- solving equations of matlab symbolic operation

% Use the solve function to solve the equation
% Example: solve the equation system: x+y=1, x-11y=5
clc;
clear;
 
% Declare the symbolic variable
syms xy;
% Define the equation
eq1 = x+y-1;
eq2 = x-11y-5 ; Automatically solve according to the default variables) % At this time, the solution obtained by solve is assigned to sol in the form of a structure, and then assigned to x and y through x=sol.x and y=sol.y respectively . sol = solve(eq1, eq2, eq3, x, y, z); x = sol.x y = sol.y % can also be used directly: % [x,y] = solve(eq1, eq2, x, y);









Guess you like

Origin blog.csdn.net/yiweiduguo/article/details/113573050
Recommended