matlab code 求助
答案:2 悬赏:80 手机版
解决时间 2021-03-22 05:03
- 提问者网友:记得曾经
- 2021-03-21 11:04
matlab code 求助
最佳答案
- 五星知识达人网友:一袍清酒付
- 2021-03-21 12:15
做个测试,希望有所帮助。
代码
% By lyqmath
function main
clc; clear all; close all;
hp = @myfun;
figure;
fplot(hp,[-10 10])
figure;
fplot(@myfun,[-10 10])
% 但如果把 hp=@myfun 删除, 并把fplot(hp,[-10 10]) 改成fplot(myfun,[-10 10])
% 就会出现如下错误:
% Error using myfun (line 2)Not enough input arguments.Error in runmyfun
% (line 2)fplot(myfun,[-10 10]) 我感觉我这样做应该没有问题。这是怎么回事看
function Y = myfun(x)
Y(:,1) = 200*sin(x(:))./x(:);
Y(:,2) = x(:).^2;
代码
% By lyqmath
function main
clc; clear all; close all;
hp = @myfun;
figure;
fplot(hp,[-10 10])
figure;
fplot(@myfun,[-10 10])
% 但如果把 hp=@myfun 删除, 并把fplot(hp,[-10 10]) 改成fplot(myfun,[-10 10])
% 就会出现如下错误:
% Error using myfun (line 2)Not enough input arguments.Error in runmyfun
% (line 2)fplot(myfun,[-10 10]) 我感觉我这样做应该没有问题。这是怎么回事看
function Y = myfun(x)
Y(:,1) = 200*sin(x(:))./x(:);
Y(:,2) = x(:).^2;
全部回答
- 1楼网友:千夜
- 2021-03-21 13:38
关于哪方面matlab code ?
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯