i want to plot sin 27 degree and 26.94 amd frequency 108.25MHz i dont know how to plot help me pls.

1 次查看(过去 30 天)
i want to plot sin 27 degree and 26.94 amd frequency 108.25MHz i dont know how to plot help me pls. it is difference phase and frequncy equal t

回答(1 个)

Amith
Amith 2024-8-8
Hi Thananthorn,
To plot the sine waves for the angles 27 degrees and 26.94 degrees with a frequency of 108.25 MHz in MATLAB, you can follow these steps:
  1. Convert the angles from degrees to radians.
  2. Define the time vector.
  3. Compute the sine values for the given angles and frequency.
  4. Plot the sine waves.
Please refer to the code example below for more insight on to the steps (assuming values) :
% Define the angles in degrees
angle1_deg = 27;
angle2_deg = 26.94;
% Convert the angles to radians
angle1_rad = deg2rad(angle1_deg);
angle2_rad = deg2rad(angle2_deg);
% Define the frequency in Hz (108.25 MHz)
frequency = 108.25e6;
% Define the time vector
% Let's plot for a duration that covers a few periods of the sine wave
duration = 1e-6; % 1 microsecond
sampling_rate = 1e9; % 1 GHz sampling rate
t = 0:1/sampling_rate:duration;
% Compute the sine values
y1 = sin(2 * pi * frequency * t + angle1_rad);
y2 = sin(2 * pi * frequency * t + angle2_rad);
% Plot the sine waves
figure;
plot(t, y1, 'b', 'DisplayName', '27 degrees');
hold on;
plot(t, y2, 'r', 'DisplayName', '26.94 degrees');
hold off;
% Add labels and legend
xlabel('Time (seconds)');
ylabel('Amplitude');
title('Sine Waves for 27 degrees and 26.94 degrees with 108.25 MHz Frequency');
legend show;
grid on;
Hope this helps!
  1 个评论
Steven Lord
Steven Lord 2024-8-8
FYI, rather than converting the angles from degrees to radians in order to pass those inputs into the radian-based trig functions like sin and cos you could call the degree-based trig functions like sind, cosd, etc. directly on the angles in degrees.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 MATLAB 的更多信息

产品


版本

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by