hallo firends,

Can any body help me write this below code into MATLAB object oriented or C code form please?

M=50; % total number of periods. (choose for 1s duration)

f0 = 50; % fundamental AC frequency

T0 = 1/f0; %fundamental AC period

T = M*T0; %Time for M periods (integer M)

N=30; % sample points per period.

dt = T0/N; % Sample at N points per period (integer N > 20)

t = dt*[1:M*N-1]; % Sampling time array

A0=120/2; % amplitude of AC signal. Divide by 2 or maybe sqrt (2) ?

AC=A0*sin(f0*t*2*pi); % create AC signal.

DC0=50; % DC amplitude

DC=DC0*ones(1,length(t)); % create a DC signal that is constant of length t

S=AC+DC; % total signal is AC signal + DC signal

figure(1);

plot(t,S); % plot signal.

xlabel('time');ylabel('Signal');

title('Total Signal');

% filter components

fAC=S-mean(S); % here is the AC component

fDC=mean(S); % here is the DC component

figure(2);

plot(t,fAC,'r',t,fDC,'b'); % plot AC and DC signals

legend('AC','DC');

xlabel('time');ylabel('Signal');

title('Signal with only AC component');

figure(3);

plot(t,fDC,'b'); % plot DC signal

legend('DC');

xlabel('time');ylabel('Signal');

title('Signal with only DC component');

figure(4);

% best to plot in Fourier domain

u=abs(fftshift(fft(S)));

NumPoints=length(t);

freq=(1/dt)*[1:NumPoints]/NumPoints; % create frequency axis

freq=freq-max(freq)/2; % center about 0

plot(freq,u);

xlabel('frequency');ylabel('signal');

title('Fourier transform');

with best regards,

Gopal

1. MATLAB algorithm to MATLAB function code or C code

2. request for matlab code-3D spiht image compression MATLAB CODE

This is not a place to come and request people to do your work for you.

3. converting c++ code to Matlab code using Matlab 9

4. [REQ: CODE REVIEW] program that prints its source code

5. Hard Code Native Error code in program?

6. registration codes/key codes for addons to a program and addons in general

7. how to use the design results of the vhdl code for a program in C code

8. HOW DO I SCRAMBLE CODE MY ACCESS PROGRAM CODING??

9. Help for Coding Java Program to zip code based search results

10. GUI Programming by hand not code with Python Code

11. Help! Can't open Labview program with MATLAB codes !!!

12. Errors when integrating MatLab code into C# program

13. How to use MATLAB's capabilities from JAVA coded programs

1 post • Page:**1** of **1**