注册 登录
编程论坛 Matlab

[求助]这个程序怎么运行不了?

lingke125 发布于 2006-06-20 01:04, 709 次点击
是关于冲击谱公式的:
function [τ0,fc,t]=chongjipu[t,Y]
τ0=0.016;
fc=10/pi;
t=0:0.001:0.03;
Am=(1/2*fc*τ0)^2-1;
if 0<=t<=τ0
X=sin(Pi*t/τ0)-1/2*fc*τ0*sin(2*Pi*fc*t);
else if t>τ0
X=(1/fc*τ0)*COS(Pi*fc*τ0)*sin(2*Pi*fc*(t-τ0/2));
Y=X/A;
end
plot(t,Y,'b--');
title('chongjiputu');
运行后图象没有!!
请问各位高手,问题出在哪儿?
给个解法!!


2 回复
#2
gaosong8222006-06-20 09:34
t0=0.016;
fc=10/pi;
t=0:0.001:0.03;
Am=(1/2*fc*t0)^2-1;
for i=1:31
if t(i)<=t0
X(i)=sin(pi*t(i)/t0)-1/2*fc*t0*sin(2*pi*fc*t(i));
elseif t(i)>t0
X(i)=(1/fc*t0)*cos(pi*fc*t0)*sin(2*pi*fc*(t(i)-t0/2));
end
Y(i)=X(i)/Am;
end
plot(t,Y,'b--');
title('chongjiputu');
#3
lingke1252006-06-20 10:24

谢谢了!但是我画的图怎么跟你的不一样!!

1