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