Plotting a signal in matlab
2 次查看(过去 30 天)
显示 更早的评论
Hello, i have to plot this signal:
1, -1<=t<=5
f(t)=sin(2*pi*t), 5<t<10
0, 10<t<=15
How can i plot this particular signal and how do i define it?
0 个评论
回答(2 个)
Adam Danz
2020-6-9
编辑:Adam Danz
2020-6-9
This notation,
x < y < z
is interpretted by Matlab as
(x < y) < z
but since (x < y) is always true (1) or false (0), it can be reduced to
1 < z
% or
0 < z
To create a vector of values between x and z,
x : increment : z
where increment is the step size or use
linspace(x,z,n)
where n is the number of values between and including x and z.
To determine if values in y are between x and z,
x < y & y < z % when working with vectors
x < y && y < z % when working with scalar values
18 个评论
Adam Danz
2020-6-11
The function name must match the file name. Secondly, the function name 'f' is a horrible function name. Atsushi Ueno may have given that as a generic example but you should replace that name with a meaninful function name. Good function names often include a verb that describes what the function does.
writetable()
readtable()
addpath()
plot()
get()
These all contain verbs.
Atsushi Ueno
2020-6-12
I'm sorry I've suddenly gotten into this conversation and wrote unclear comment.
But now I have learned how to answer appropriately through this conversation.
Eleftherios Venizelos
2020-6-11
2 个评论
Adam Danz
2020-6-11
The function name must match the file name.
Secondly, the function name 'f' is a horrible function name. Atsushi Ueno may have given that as a generic example but you should replace that name with a meaninful function name. Good function names often include a verb that describes what the function does.
writetable()
readtable()
addpath()
plot()
get()
These all contain verbs.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Audio Processing Algorithm Design 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!