t = 0:0.001:0.02;
v = 10*sin(2*pi*50*t);
plot(t, v, 'r--', 'LineWidth', 1.5);
xlabel('Time (s)'); ylabel('Voltage (V)');
title('50 Hz Sine Wave');
grid on; legend('v(t)');
axis([0 0.02 -12 12]);


clc;
clear;
close all;

% Parameters
Fs = 1000;
T = 1/Fs;
t = 0:T:1-T;
f = 50;

% Time-domain signal
x = sin(2*pi*f*t);

% FFT
N = length(x);
X = fft(x);

% Frequency vector
freq = (0:N-1)*(Fs/N);

% Magnitude spectrum
X_mag = abs(X)/N;

% Plot time-domain signal
figure;
plot(t,x);
xlabel('Time (s)');
ylabel('Amplitude');
title('Time-Domain Signal');
grid on;

% Plot frequency-domain signal
figure;
plot(freq,X_mag);
xlabel('Frequency (Hz)');
ylabel('Magnitude');
title('Frequency-Domain Spectrum');
xlim([0 200]);
grid on;






clc;
clear;
close all;

deg2rad(60);
z=5+j*6;
imag(z),real(z)










Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: