在matlab中如何输入矩阵方程
这需要GUI设置,举个例子:% By lyqmath% DLUT School of Mathematical Sciences% BLOG: http://blog。csdn。net/lyqmathfunction main()clc; clear all; close all;global he1 he2 he3figure; he1 = uicontrol('Style', 'Edit', 'Units', 'Normalized', 。 。。 'Position', [0。2 0。6 0。4 0。2], 'String', '0 1', 'Min', 1, 'Max', 10);...全部
这需要GUI设置,举个例子:% By lyqmath% DLUT School of Mathematical Sciences% BLOG: http://blog。csdn。net/lyqmathfunction main()clc; clear all; close all;global he1 he2 he3figure; he1 = uicontrol('Style', 'Edit', 'Units', 'Normalized', 。
。。 'Position', [0。2 0。6 0。4 0。2], 'String', '0 1', 'Min', 1, 'Max', 10);he2 = uicontrol('Style', 'Edit', 'Units', 'Normalized', 。
。。 'Position', [0。2 0。3 0。4 0。2], 'String', 'x(1)+2*x(2)^2');hb = uicontrol('Style', 'PushButton', 'Units', 'Normalized', 。
。。 'Position', [0。3 0。15 0。2 0。1], 'String', 'Compute', 。。。 'CallBack', @compute);he3 = uicontrol('Style', 'Edit', 'Units', 'Normalized', 。
。。 'Position', [0。5 0。15 0。2 0。1], 'String', 'Result = ?');function result = compute(src, event)global he1 he2 he3A = str2num(get(he1, 'String'));fun = str2func(['@(x) ' get(he2, 'String')]);result = fun(A);set(he3, 'String', sprintf('Result = %。
2f', result));结果:。收起