How do I write the following functions on Matlab x(t) = 2tcos(pi*t) , y(t) = 2sin(pi*t)
8 ビュー (過去 30 日間)
古いコメントを表示
I keep getting error using * and other errors
採用された回答
その他の回答 (2 件)
Adam
2016 年 9 月 21 日
t = linspace( 0, 2*pi, 100 );
x = 2 * t .* cos( pi * t );
y = 2 * sin( pi * t );
2 件のコメント
John D'Errico
2024 年 3 月 3 日
@Khalid Tewfik - too late for this response for you, but you need to see that you used the expression:
2*t*cos(pi*t)
Do you see you used the * operator, instead of the .* operator? The difference if important in MATLAB.
MD.AL-AMIN
2024 年 3 月 2 日
編集済み: Walter Roberson
2024 年 3 月 3 日
% Define the signal function
X = @(t) 5 * sin(2*pi*t) .* cos(pi*t - 8);
% Define the range of t
t = linspace(0, 20, 1000); % Adjust the number of points for desired resolution
% Plot the signal
figure;
plot(t, X(t));
% Label axes and title
xlabel('t');
ylabel('X(t)');
title('Signal X(t)');
% Adjust axis limits and grid (optional)
xlim([0, 20]); % Set appropriate x-axis limits
ylim([-5, 5]); % Set appropriate y-axis limits
grid on;
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Line Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!