还是matlab画图问题,要输入一个变量的clc; clear all; h=input('h=');y=zeros(1,30000);r=zeros(1,30000);for i=1:30000r(i) = unifrnd(0,1);y(i)=h*tan(pi*(r(i)-0.5));end;x=y(y>-30&y Untitled at 2syms h x画不出来图啊
来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/18 19:40:40
还是matlab画图问题,要输入一个变量的clc; clear all; h=input('h=');y=zeros(1,30000);r=zeros(1,30000);for i=1:30000r(i) = unifrnd(0,1);y(i)=h*tan(pi*(r(i)-0.5));end;x=y(y>-30&y Untitled at 2syms h x画不出来图啊
还是matlab画图问题,要输入一个变量的
clc; clear all;
h=input('h=');
y=zeros(1,30000);
r=zeros(1,30000);
for i=1:30000
r(i) = unifrnd(0,1);
y(i)=h*tan(pi*(r(i)-0.5));
end;
x=y(y>-30&y Untitled at 2
syms h x
画不出来图啊
还是matlab画图问题,要输入一个变量的clc; clear all; h=input('h=');y=zeros(1,30000);r=zeros(1,30000);for i=1:30000r(i) = unifrnd(0,1);y(i)=h*tan(pi*(r(i)-0.5));end;x=y(y>-30&y Untitled at 2syms h x画不出来图啊
你可以这样写程序:
clc; clear all;
syms h x
h=input('h=');
y=zeros(1,30000);
r=zeros(1,30000);
for i=1:30000
r(i) = unifrnd(0,1);
y(i)=h*tan(pi*(r(i)-0.5));
end;
x=y(y>-30&y<30);
n=hist(x,20)
hist(x,20)
hold on;
x=-30:0.1:30;
plot(x,30000*h./(pi*(x.*x+h*h)),'r')