Question
Please solve part d in MATLAB

Problem Statement Consider the Shockley diode equation, which approximates the current-voltage (characteristic) curve of a diode: Here, is the current flowing through the diode (in amperes), and Vo is the voltage drop across the diode (in volts). VT is the thermal voltage, which varies based on the temperature. Assume that VT0.026 V, which is true when the diode is a little above room temperature. Therefore, in this equation, there are two unknown parameters that depend on the design/fabrication/environment of the diode: Is, the saturation current (in amperes), and n, the ideality factor (unitless) Our goal is to find values of Is and n that cause the equation to closely model a measured diode. A. Assume we have applied several voltages (VO) to a diode and measured the resulting currents 0.800 0.825 0.850 0.875 0.9000.925 0.950 0.975 0.0372 0.0670 T(A) 0.0074 0.0124 0.0129 0.1264 0.2571 0.5158 B. Determine reasonable starting values of Is and n for the optimization/regression. You can either plug two arbitrarily selected data points into the diode equation and use a nonlinear equation-solving technique (c.g. fsolve) to find starting values, or you can look at documentation or specification sheets for typical diodes to determine what starting values might be reasonable C. Use fminsearch or fitnlm to find values of Is and n that make the Shockley diode equation best fit the measured data points. See the MATLAB documentation and lecture notes (lecturel 8.pdf and fminsearch.pdf) for more information, but here are some tips: For fminsearch, you will have to write an objective function that computes an error value (e.g., the sum of squared errors, SSE). The input to the objective function should be a vector containing the current values of Is and n. fminsearch will repeatedly call your objective function with different values of Is and n, so your function must use these parameters (and the measured data points) to compute and return the corresponding error value For fitnlm, you do not need to write a function that computes an error value. Instead, you need to provide fitn1m with the format of your fit equation (Shockley diode equation) using be and b1 in place of Is and n Determine if the values of Is and n you find produce a good fit to the measured data points. This will require plotting the fit equation on the same figure as the measured data, and perhaps looking at r2 values. If the equation is a poor fit for the measurements, try using different starting values of Is and n or altering other parameters/options of fminsearch or fitnlm. D.
0 0
Add a comment Improve this question Transcribed image text
Answer #1

a)clc;
clear all;
close all;


b=101;%number of bit
data=randint(1,b);%random bit generation (1 or 0)
s=2*data-1;%conversion of data for BPSK modulation
SNRdB=0:9; % SNR in dB
SNR=10.^(SNRdB/10);
for(k=1:length(SNRdB))%BER (error/bit) calculation for different SNR
y=s+awgn(s,SNRdB(k));
error=0;
for(c=1:1:b)
if (y(c)>0&&data(c)==0)||(y(c)<0&&data(c)==1)%logic acording to BPSK
error=error+1;
end
end
error=error/b; %Calculate error/bit
m(k)=error;
end
figure(1)
%plot start
semilogy(SNRdB,m,'r','linewidth',2),grid on,hold on;
BER_th=(1/2)*erfc(sqrt(SNR));
semilogy(SNRdB,BER_th,'k','linewidth',2);
title(' curve for Bit Error Rate verses SNR for Binary PSK modulation');
xlabel(' SNR(dB)');
ylabel('BER');
legend('simulation','theorytical')
b)bpsk transmitter matlab code corresponding to 3 bits

clear all;

close all;

T=1;%Bit rate is assumed to be 1 bit/s;

%bits to be transmitted

b=[1 0 1];%b is the number of bits to be transmitted i.e 3 bits

NRZ_out=[];

%Vp is the peak voltage +v of the NRZ waveform

Vp=1;

%Here we encode input bitstream as Bipolar NRZ-L waveform

for index=1:size(b,2)

if b(index)==1

NRZ_out=[NRZ_out ones(1,200)*Vp];

elseif b(index)==0

NRZ_out=[NRZ_out ones(1,200)*(-Vp)];

end

end

%Generated bit stream impulses

figure(1);

stem(b);

xlabel('Time (seconds)-->')

ylabel('Amplitude (volts)-->')

title('Impulses of bits to be transmitted');

figure(2);

plot(NRZ_out);

xlabel('Time (seconds)-->');

ylabel('Amplitude (volts)-->');

title('Generated NRZ signal');

%generation of modulated signal

t=0.005:0.005:5;

f=5; %Frequency of the carrier

%Here we generate the modulated signal by multiplying it with carrier (basis function)

s=NRZ_out.*(sqrt(2/T)*cos(2*pi*f*t));

figure;

plot(s);

xlabel('Time (seconds)-->');

ylabel('Amplitude (volts)-->');

title('BPSK Modulated signal');

c) bpsk receiver matlab code

y=[];

%We begin demodulation by multiplying the received signal again with the carrier (basis function)

demodulated=Modulated.*(sqrt(2/T)*cos(2*pi*f*t));

%Here we perform the integration over time period T using trapz

%Integrator is an important part of correlator receiver used here

for i=1:200:size(demodulated,2)

y=[y trapz(t(i:i+199),demodulated(i:i+199))];

end

received=y>0;

figure;

stem(received)

title('Impulses of Received bits');

xlabel('Time (seconds)-->');

ylabel('Amplitude (volts)')

%demodulation over a noisy signal

Eb_N0_dB = 0 ;% Normalized bit SNR in dB.

Eb_N0=10^(Eb_N0_dB/10);% convert the given Eb_No_dB to linear scale

%compute the noise variance which is the same as noise power

M=2;% BPSK is a binary signaling scheme(two symbols)

fs=1000;

T=1;%Data rates (bits/sec)

Ts=T/log2(M);% symbol rate (or modulation rate D) in symbols/sec (bauds)

R=1/Ts;% symbol time (equals bit time in Binary signaling e.g. BPSK)

A=5;% baseband (NRZ-L) pulse amplitude ;

E=A^2*T;% Energy per symbol

ts=1/fs;

t=0:ts:1

noiseVariance=E*fs/(2*log2(M)*Eb_N0);

sigma_n=sqrt(noiseVariance);% standard deviation of noise

n = sigma_n*randn(1,length(s));% generate noise samples

r = s+n ;% received noisy signal array

% plot the received bandpass signal.

subplot(4,1,4);

plot(t,r);

axis([0 MaxPlotTime min(r) max(r)]);

grid on;

xlabel('time');

ylabel('r(t)');

title('Received Bandpass BPSK signal r(t)');

%repeat the simulation using Eb_N0=10db,20db,30db

Add a comment
Know the answer?
Add Answer to:
Please solve part d in MATLAB Problem Statement Consider the Shockley diode equation, which approximates the...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Matlab Matlab Matlab Matlab, Please solve this problem Problem 4 : Runge's phenomenon For this proble,...

    Matlab Matlab Matlab Matlab, Please solve this problem Problem 4 : Runge's phenomenon For this proble, you wil interpolate the function h(x) = tanh(10x) in I [a, b, through n datapoints (xi, hx with equidistant nodes for several values of n, and observe the behavior of the interpolating polynomial as n increases. You should use the pair of functions polyfit and polyval In your prob40: (a) Interpolate the function tanh(10x) in [-1,1] using a uniform grid of n nodes, where...

  • Can you please do this in matlab Consider the following function: 4 0 Using the following...

    Can you please do this in matlab Consider the following function: 4 0 Using the following parameters in your functions: func: the function/equation that you are required to integrate a, b: the integration limits n: the number of points to be used for the integration : Integral estimate A. Write a function capable of performing numerical integration of h(x) using the composite B. write a function capable of performing numerical integration of h(x) using the composite C. Calculate the absolute...

  • II. Matlab Problems 1. A student in the laboratory analyzes an amplifier circuit and determines that,...

    II. Matlab Problems 1. A student in the laboratory analyzes an amplifier circuit and determines that, theoretically, the observed output current low should be proportional to a linear combination of two input voltages, Vy and vy. He then applies two variable voltage sources as vx and vy and records the current four for each set of inputs. The data she records is shown in the table below: -5 -5 -5 -5 -2 -2 -2 0 0 2 2 2 0252...

  • 5. (12.5%) The ideal D/A converter described by equation (6.25), equation (6.20), and equation (6...

    Please offer the Matlab code.Answer the question b.c.f.g. 5. (12.5%) The ideal D/A converter described by equation (6.25), equation (6.20), and equation (6.24) cannot be constructed because they require an infinite number of past and future samples of c(t) for the interpolation. However they can be approximated by using only a finite number of terms. Here we consider 2 methods Method I is to use only (N 1) terms of the sum in equation (6.25) as: sin IT(t nT)/T] T(t...

  • Submission Items: (1) A Word document in which you: a. Describe in brief the problem you...

    Submission Items: (1) A Word document in which you: a. Describe in brief the problem you are solving and the numerical method used. b. Snapshot of the output, when you run the program for the conditions mentioned in the questions. c. Discuss your results. (2) MATLAB code (m) file() Question 1: [10 points) Write a MATLAB function that calculates the approximate value of arctan(x) using the Maclaurin series approximation: arctan(x) = x- + +... The function should accept 3 parameters:...

  • A group of physics students collected data from a test of the projectile motion problem that...

    A group of physics students collected data from a test of the projectile motion problem that was analyzed in a previous lab exercise (L5). In their test, the students varied the angle and initial velocity Vo at which the projectile was launched, and then measured the resulting time of flight (tright). Note that tright was the dependent variable, while and Vo were independent variables. The results are listed below. (degrees) Time of Flight (s) Initial Velocity V. (m/s) 15 20...

  • PROBLEM: Simulate the resistance and the current across a circuit Consider the following circuit Where V-...

    PROBLEM: Simulate the resistance and the current across a circuit Consider the following circuit Where V- voltage from a battery source (unit of measure: Volts). I-Current (unit of measure: Amperes) And Ri, R. Rs are resistors connected in parallel (unit of measure: Ohms) When resistors are connected in parallel, the equivalent resistance, Ra, can be computed: By Ohm's Law, Components are designed to perform at a nominal value, however, due to manufacturing inconsistencies all components are subject to variation from...

  • solve using Matlab please Problem 2. Measurement Error You work for a precision spring company and...

    solve using Matlab please Problem 2. Measurement Error You work for a precision spring company and you have been asked to solve a problem in the quality assurance area. You are given a bunch of spring data. The displacement of the spring is measured as a function of a force applied to the spring. The factory does not care so much about the actual spring constant as they do that they spring constant does not vary too much from spring...

  • MATLAB Create a function that provides a definite integration using Simpson's Rule Problem Summar This example demo...

    MATLAB Create a function that provides a definite integration using Simpson's Rule Problem Summar This example demonstrates using instructor-provided and randomized inputs to assess a function problem. Custom numerical tolerances are used to assess the output. Simpson's Rule approximates the definite integral of a function f(x) on the interval a,a according to the following formula + f (ati) This approximation is in general more accurate than the trapezoidal rule, which itself is more accurate than the leftright-hand rules. The increased...

  • 1) Use the Matlab function polyfit to curve fit the saturation pressure versus temperature data a...

    MATLAB Code for question (2) 1) Use the Matlab function polyfit to curve fit the saturation pressure versus temperature data along the vaporization line for water in the table below with a polynomial of degree n. The Matlab function polyval may be used to evaluate the polynomial at any point. Compare the saturation pressure as calculated by the polynomial with the data given in the table and observe what happens as the degree of the polynomial n is increased. Tabulate...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT