本文介绍了如何在Matlab符号方程中产生方波的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的项目要求我使用Matlab创建一个内部带有方波的符号方程. 我试图这样写,但无济于事:
My project require me to use Matlab to create a symbolic equation with square wave inside. I tried to write it like this but to no avail:
syms t; a=square(t);
输入参数必须为'double'.
Input arguments must be 'double'.
我该怎么做才能解决此问题?预先感谢您提供的帮助.
What can i do to solve this problem? Thanks in advance for the helps offered.
推荐答案以下是使用floor和sign函数的几个常规选项:
here are a couple of general options using floor and sign functions:
f=@(A,T,x0,x) A*sign(sin((2*pi*(x-x0))/T)); f=@(A,T,x0,x) A*(-1).^(floor(2*(x-x0)/T));例如,使用floor函数:
syms x sqr=2*floor(x)-floor(2*x)+1; ezplot(sqr, [-2, 2])
更多推荐
如何在Matlab符号方程中产生方波
发布评论