how i can change the variable? pleasee
显示 更早的评论
Look at the first code, if you realize and = (x. ^ 3) it is the same as E. ^ 3 that I want to do but in a general way in the code of my gui but what happens is that I do not know. The user for example x ^ 2 but I want to read my program to change it to E. ^ 2 and so it can work. My program asks for this to get the area under the curve and graph it
%FIRST CODE
a=input('Since: ');
b=input('until: ');
x=linspace(a,b,500);
y=(x.^3);
syms K;
syms n;
D=(b-a)/n;
E= a+((K-1)*D)+(D/2);
F= (E.^3)*D;
f= symsum (F,K,1,n);
A= limit(f,n,inf)
area(x,y);
grid on;
%SECOND CODE
a=str2double(get(handles.edit7,'string'));
b=str2double(get(handles.edit6,'string'));
x=linspace(a,b,500);
y=(get(handles.edit4,'string'));
j=char(y);
syms K;
syms n;
D=(b-a)/n;
E= a+((K-1)*D)+(D/2);
F=(j)*D;
f= symsum (F,K,1,n);
A= limit(f,n,inf)
axes(handles.axes3);
area(x,y);
grid on;
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Code Performance 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!