在matlab中如何输入矩阵方?
在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);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));结果:。
答:可以用ginput,但是这样只能估计 如果已经作出直线,可以在命令窗口输入 [a,b]=ginput(2) 然后在图象上用鼠标左键点取所求直线上两点 输入(b(...详情>>