Question
atlab Function Help: Currently I Have Written This Code For Performing The Task Found At The Bottom: The Top Commented Portion Of The Code Will
Matlab function help:
Currently I have written this code for performing the task found at the bottom:
The top commented portion of the code will create a halfwave rectifier while the rest allows for a call to access either a full wave or half wave rectifier. I am having trouble calling the function properly usingmain(wfm, N, f0, Vrms).I need to pass the function through a fourier series and plot the function as well. Please help and explain!
%Half-wave Rectifier
%{
l=linspace(0,10,100);
sig=sin(2*pi*50*l);
subplot(211)
plot(sig); grid
% u=1:9;
% t=(1:)
for t=1:100
if sin(2*pi*50*l(t))
sig(t)=0;
else
sig(t) = sin(2*pi*50*l(t));
end
end
subplot(212)
plot(sig); grid
%}
clc
clear
flag = input('Select "1" for halfwave or "2" for fullwave=');
T = input('Time period of input signal (in seconds)=');
To = T/2;
A = input('Peak value of input signal=');
n = ceil(To/0.0001);
N = n * 0.0001;
w = zeros(2*n,1);
k = [-N:1:N];
if flag == 1
for i = 1:2*n
if i >= n;
%w(i) = (2*pi/To)*i*0.0001;
%wt = w;
%disp('Halfwave Vectors');
%disp(wt);
l=linspace(0,10,100);
sig=sin(2*pi*50*l);
subplot(211)
plot(sig); grid
% u=1:9;
% t=(1:)
for t=1:100
if sin(2*pi*50*l(t))
sig(t)=0;
else
sig(t) = sin(2*pi*50*l(t));
end
end
subplot(212)
plot(sig); grid
end
end
end
if flag == 2
%for i = 1:2*n
%if i >= n;
%w(i) = (2*pi/To)*i*0.0001;
%wt = w;
%disp('Fullwave Vectors');
%disp(wt);
%end
%end
end
Task to be completed instructions:
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started