matlab如何编写我这个函数global N;syms omega kai yupuseilong t;function f=zi/z2;z1=sqrt(1/4*(1-(omega*kai/yupuseilong^2)*sin(yupuseilong*t))^2);z2=(1-(kai^2/2*yupuseilong^2)*sin(yupuseilong*t)^2);delta(f)=z1/z2;Fs=N*delta(f(t));pretty(Fs);sim

来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/26 09:33:36
matlab如何编写我这个函数globalN;symsomegakaiyupuseilongt;functionf=zi/z2;z1=sqrt(1/4*(1-(omega*kai/yupuseilon

matlab如何编写我这个函数global N;syms omega kai yupuseilong t;function f=zi/z2;z1=sqrt(1/4*(1-(omega*kai/yupuseilong^2)*sin(yupuseilong*t))^2);z2=(1-(kai^2/2*yupuseilong^2)*sin(yupuseilong*t)^2);delta(f)=z1/z2;Fs=N*delta(f(t));pretty(Fs);sim
matlab如何编写我这个函数
global N;
syms omega kai yupuseilong t;
function f=zi/z2;
z1=sqrt(1/4*(1-(omega*kai/yupuseilong^2)*sin(yupuseilong*t))^2);
z2=(1-(kai^2/2*yupuseilong^2)*sin(yupuseilong*t)^2);
delta(f)=z1/z2;
Fs=N*delta(f(t));
pretty(Fs);
simple(Fs);
电脑每次都跟我说是这个问题
Error:File:squeezing.m Line:3 Column:1
Function definitions are not permitted in this context.
我就是想算出来Fs的表达式,然后做图出来,变量应该只有t,也就是最后出图应该是一个自变量是t,因变量是Fs的二维图.function指令应该怎么改?
从新改了一下.先不用出图了,就先把Fs给算出来就行了,应该是Fs=sqrt((4x^2+1)-/(2*x+1)^2)
global N;
N=2;
syms omega kai yupuseilong t;
deltaSy=sqrt(1/2*(1-(omega*kai/yupuseilong^2)*sin(yupuseilong*t))^2);
Sx=(1-(kai^2/2*yupuseilong^2)*sin(yupuseilong*t)^2);
yupuseilong=sqrt(omega^2+(kai/2)^2);
x=omega/kai;
Fs=N*deltaSy/abs(Sx);
pretty(Fs);
simple(Fs);
我现在不会把x带入Fs里面

matlab如何编写我这个函数global N;syms omega kai yupuseilong t;function f=zi/z2;z1=sqrt(1/4*(1-(omega*kai/yupuseilong^2)*sin(yupuseilong*t))^2);z2=(1-(kai^2/2*yupuseilong^2)*sin(yupuseilong*t)^2);delta(f)=z1/z2;Fs=N*delta(f(t));pretty(Fs);sim
你看看下面的例子吧,不要使用function了:
syms omega kai yupuseilong t N;
z1=sqrt(1/4*(1-(omega*kai/yupuseilong^2)*sin(yupuseilong*t))^2);
z2=(1-(kai^2/2*yupuseilong^2)*sin(yupuseilong*t)^2);
f=z1/z2;
Fs=N*f;
Fs=simple(Fs);
pretty(Fs);
这时候Fs的表达式已经得到了,你不是要画图吗,那你就需要给出其他参数的值来.比如
omega=1;
kai=2;
yupuseilong=3;
N=4;
然后把Fs的表达式求出来,使用语句
Fs=eval(Fs);
现在开始画图
ezplot(Fs,[0 0.3])
祝你学习愉快!