ploting a specific function.
古いコメントを表示

hi, anyone knows how can I plot this function in Matlab?
thanks...
1 件のコメント
Walter Roberson
2016 年 12 月 12 日
Are the vertical parts intended to be sudden jumps ("the value reached 1 and jumped to 0") or are they intended to be lines?
Do you just need to plot the values, or do you need all of the intermediate values?
採用された回答
その他の回答 (2 件)
Kenny Kim
2016 年 12 月 12 日
t = linspace(0,1,10001);
x = nan(size(t));
for i =1:numel(t)
if t(i) <=0.2
x(i) = 5*t(i);
elseif t(i) >0.2 && t(i) <= 0.3
x(i) = 0;
elseif t(i) > 0.3 && t(i) <= 0.7
x(i) = 1 - 5*(t(i) - 0.3);
elseif t(i) > 0.7 && t(i) <= 0.8
x(i) = 0;
else
x(i) = -1 + 5*(t(i) - 0.8);
end
end
plot(t,x); xlabel('Time (s)'); ylabel('x(t)'); title('Giris Isareti');

ahmet cakar
2016 年 12 月 13 日
0 投票
4 件のコメント
Hopefully this is what you meant.
If you continue from where I left:
fc = 100; % cosine freq
% Next multiply by 100 hz signal
x = x.*cos(2*pi*fc*t);
plot(t,x);
you get:

If you are using Walter's method then replace x with y and t with x.
ahmet cakar
2016 年 12 月 13 日
Walter Roberson
2016 年 12 月 13 日
ahmet cakar
2016 年 12 月 14 日
カテゴリ
ヘルプ センター および File Exchange で Modulation についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!