Question

Please help me write a code for this in Matlab T = 1 millisecond Vm =...

Please help me write a code for this in Matlab

T = 1 millisecond

Vm = 1 volt (amplitude voltage)

t = linspace(-T, 2*T, 3001)

The following pararameter is given

v(t) = Vm - (Vm/T)t for 0<= t <= T

0 elsewhere

I need to modify the vector v so that is represents a periodic function with a period T over this time period
(hint: it should look like a sawtooth), and plot v vs t over the range from -T to 2T.

0 0
Add a comment Improve this question Transcribed image text
Answer #1
T = 1;%millisecond
Vm = 1;%volt (amplitude voltage)
t = linspace(-T, 2*T, 3001);%To plot over the range -T to 2T
v = zeros(1, length(t));%Create a vector of size same as that of t
for i = 1:length(t)
    if t(i) >= 0 && t(i) <= T%If 0 <= t <= T
        v(i) = Vm - (Vm./T).*t(i);
    end
end

plot(t, v);
title('Plot: v vs t');
xlabel('Time period(t)');
ylabel('Voltage(v)');

OUTPUT:

Add a comment
Know the answer?
Add Answer to:
Please help me write a code for this in Matlab T = 1 millisecond Vm =...
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
  • please do this problem in matlab and show me the code. Thanks. please do this problem...

    please do this problem in matlab and show me the code. Thanks. please do this problem in matlab and show me the code. Thanks. please do this problem in matlab and show me the code. Thanks. please do this problem in matlab and show me the code. Thanks. please do this problem in matlab and show me the code. Thanks.please do this problem in matlab and show me the code. Thanks. please do this problem in matlab and show me...

  • PLEASE USE MATLAB this problem you are trying to find an approximation to the periodic function /(t) esint-1) over one period, o <t < 2π. In t-linspace(0,2*pi,200)' and let b be a column ve...

    PLEASE USE MATLAB this problem you are trying to find an approximation to the periodic function /(t) esint-1) over one period, o <t < 2π. In t-linspace(0,2*pi,200)' and let b be a column vector of evaluations of f at those points. (a) Find the coefficients of the least squares fit In MATLAB, let (b) Find the coefficients of the least squares fit f(t)ndy+d2 cos(t)+ d, sin(t)+d, cos(2t)+dy sin(2t). (c) Plot the original function f(t)and the two approximations from (a) and...

  • please do this problem in matlab and show me the code. Thanks. please do this problem...

    please do this problem in matlab and show me the code. Thanks. please do this problem in Matlab and show me the code. Thanks. Problem #1: Circuits and linear-systems In the last HW you developed the governing equations for the “Wheatstone”-bridge circuit used extensively in engineering applications (shown below). B R R2 A D G m RA с E The resulting equations were solved for the output voltage and currents using the function: function [V_out, I_vector] =Wheatstone_bridge (v_in, R_vector) In...

  • WRITE MATLAB CODE FOR IT. Task 02: For the circuit shown in figure 12.2, the input...

    WRITE MATLAB CODE FOR IT. Task 02: For the circuit shown in figure 12.2, the input voltage is Vi(t)-10 cos(2t) u(t) I. Plot the steady state output voltage voss(t) for t > 0 assuming zero initial conditions. I1. Determine whether the system is stable or mot? 0.5 F 2 Ohm v(t) Vo (t) 1 Ohm Figure 12.2

  • Need help with matlab code. If writing code out please make it where i can understand...

    Need help with matlab code. If writing code out please make it where i can understand and read it. I would prefer to see it in matlab form. Thanks Consider the RC Circuit shown below. Assume the excitation is a 10 kHz sine wave with amplitude of 1 volt. Derive expressions for the voltages across the resistor and the capacitor as time functions. Plot the voltages across the resistor and the capacitor over two periods using MATLAB and a reasonable...

  • I need help with Matlab code. Thank you Consider the RC Circuit shown below. Assume the...

    I need help with Matlab code. Thank you Consider the RC Circuit shown below. Assume the excitation is a 10 kHz sine wave with amplitude of 1 volt. Derive expressions for the voltages across the resistor and the capacitor as time functions. Plot the voltages across the resistor and the capacitor over two periods using MATLAB and a reasonable time interval (eg, = T 20) Capture the plot and paste it as Figure 1 in the report form

  • Please include your matlab code and plot, as well as the derivation of the expressions for...

    Please include your matlab code and plot, as well as the derivation of the expressions for voltages across both the resistor and inductor themselves. Really need help understanding this! 5. Consider the RL Circuit shown below. Assume the excitation is a 10 kHz sine wave with amplitude of 1 volt. Derive expressions for the voltages across the resistor and the inductor as time functions. Plot the voltages across the resistor and the inductor over two periods using MATLAB and a...

  • Can you write hand solutions and matlab code please? Q3) There is a square wave with...

    Can you write hand solutions and matlab code please? Q3) There is a square wave with the period of T=21. The amplitude is 3 between 0 and it The amplitude is 0 between 1 and 2 T. 2 3 4 5 a) Find the Fourier series coefficients of this square wave. a = x()ật Il x(t)cos(kt)dt bx = ( x(t)sin(kt)dt b) Using Matlab, plot the truncated Fourier series; (1) For k 0 to 10 (II) For k 0 to 1000...

  • use MATLAB and PLZ comment the code so that it is easy to understand Implement the...

    use MATLAB and PLZ comment the code so that it is easy to understand Implement the following series of sinusoidal signals in MATLAB: 1 sin(kt) where N 30 k=1 x(t) k 1 Write a MATLAB script which does the following steps First define and plot signal sin(t) for 0 St s 3Twhere T is the fundamental period of this signal The signal you just implemented is x(t) with N 1 a. Then modify your code to be able to define...

  • Can someone please solve the below lab in MATLAB showing the code and the output result...

    Can someone please solve the below lab in MATLAB showing the code and the output result as well please? Me and my partners cannot get our codes to give us the outputs. 10. The current flowing through a certain inductor is found to be given by i() = 0.20e-2- 0.6e-3t V. (a) Plot each of the two components over the range of 0 t 1.5 s. (b) Plot the inductor current over the same time range. (c) Plot the en-...

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