Question

1. Write an Octave script (lab02_01.m), perform the following operation.    (a) Create two variable a1=5,...

1. Write an Octave script (lab02_01.m), perform the following operation.

   (a) Create two variable a1=5, a2=7;
   (a) Create a vector t from 0 to 2 with step size to 0.001;
   (b) Create a vector sig of a1sin(22t)+a2sin(24t);
   (c) Plot the vector sig vs t in a subplot region 1;

(d) Using For, While, if statement, perform the following operation
       (i) sig_2 = sig        if sig>0
       (ii) sig_2=-sig*2+1    if sig<0

   (e) Plot the vector sig_2 vs t in a subplot region 2;
   (f) Save the program to the file, “lab02_01.m”.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Octave Script :

Text :

clear all;
clc;
a1 = 5;
a2 = 7;
t = 0:0.001:2;
sig = a1*sin(22*t) + a2*sin(24*t);
subplot(211)
plot(t,sig)
title('Plot of sig')
xlabel('--> Time')
ylabel('--> Amplitude')

sig_2 = sig.*(sig>=0) - ((sig*2)+1).*(sig<=0);
subplot(212)
plot(t,sig_2);
title('Plot of sig_2')
xlabel('--> Time')
ylabel('--> Amplitude')

Plots :

Add a comment
Know the answer?
Add Answer to:
1. Write an Octave script (lab02_01.m), perform the following operation.    (a) Create two variable a1=5,...
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
  • 1. Write a short MATLAB script or function (m-file) that generates the functions (t)eu(t) for a =...

    Only calculate manually 1. Write a short MATLAB script or function (m-file) that generates the functions (t)eu(t) for a = 0.1. Plot the value of x(t). Since the e-af almost attenuates to 0 after 5T, where T1. So make your time vector from 0 to 5T would be enough to capture the signal.) 2. Using the definition of the FT (1), manually calculate the FT of the given functions in previous exercise 0O x(t)e 3. Plot the absolute values and...

  • (In Linux) 1. Create a file to write to from your script and save it as...

    (In Linux) 1. Create a file to write to from your script and save it as “.txt”. 2. Write the following information to the file that you created in Step 1: Today's date Your full name Your student ID The name of your course What directory you are in File permissions of the file that you created that allow everyone to read, write, and execute The long list of files in your current directory, providing all items and their process...

  • Create a new MATLAB Script file named MT3P3_itname.m. In your script file perform the following calculations:...

    Create a new MATLAB Script file named MT3P3_itname.m. In your script file perform the following calculations: Prompt the user to enter an integer. Use a multiple if-elseif structure to determine the following: Confirm that the number is an integer. If not, the program displays message 1. Check if the number is divisible by 2 and displays message 2. Check if the number is divisible by 3 and displays message 3. For anything other than 1, 2, or 3, the program...

  • MATLAB (2 points) Challenge. Create a SCRIPT file called thirdOrderDE.m 5) Blasius showed in 1908 that the solution to the incompressible flow field in a laminar boundary layer on a flat plate is...

    MATLAB (2 points) Challenge. Create a SCRIPT file called thirdOrderDE.m 5) Blasius showed in 1908 that the solution to the incompressible flow field in a laminar boundary layer on a flat plate is given by the solution of the fol- lowing third-order ordinary nonlinear differential equation Rewrite this equation into a system of three first-order equations, using the following substitutions: h,(m) = f d2 Solve using the ode45 function with the following initial conditions: hi (0) = 0 hs(0) =...

  • Nay programming languge is fine (MatLab, Octave, etc.) This is the whole document this last picture...

    Nay programming languge is fine (MatLab, Octave, etc.) This is the whole document this last picture i sent is the first page 5. Write and save a function Sphere Area that accepts Radius as input argument, and returns SurfaceArea (4 tt r) as output argument. Paste the function code below. Paste code here 6. Validate your Sphere Area function from the command line, checking the results against hand calculations. Paste the command line code and results below. 7. Design an...

  •    MATLAB SCRIPT PLEASE Matlab MATH 210 in 2020 Homework Assignment 8- Due 3/25, 11:59PM Each...

       MATLAB SCRIPT PLEASE Matlab MATH 210 in 2020 Homework Assignment 8- Due 3/25, 11:59PM Each plot should have its own figure associated with it. In all questions, give the figure a title, and label the acis. Save your matlab script as drill 10.m Do not use the fplot command. 1. Plot the function f(x) = (x + 5)2 for -5 <<<10. Include a plot title, and label both aris. 2. Use the subplot command to make two plots of...

  • Create a single script (.m file) to complete this assignment. Unless directed otherwise, use meaningful variable...

    Create a single script (.m file) to complete this assignment. Unless directed otherwise, use meaningful variable names for each variable: do not use the default variable ans to store your results. For this assignment do not suppress your output with semi- colons (). Each problem (ie. Problem 1. Problem 2, and Problem 4) should be in a separate cell, using the cell mode feature of MATLAB; the subparts should all be contained in the same cell as the parent problem....

  • MATLAB : Practice-4 (Oct. 31/ Nov. 1) Seat No. Name: Solve the following problems and write...

    MATLAB : Practice-4 (Oct. 31/ Nov. 1) Seat No. Name: Solve the following problems and write in the answers in blue and the plot in the box. Save the file in a pdf format and submit the answer script file and the pdf file to E-Class. 1. Re-do the Sample Problem 6-11 (Flight of a model rocket), but with the following conditions. - 16N force during the first 0.2 second - Parachute open when the downward velocity reaches 25 m/s...

  • Emergency please!!!! Last two numbers digit: 11 1) (35 pts) In this problem the last two...

    Emergency please!!!! Last two numbers digit: 11 1) (35 pts) In this problem the last two digits of your student number will be important. Let n, be a number equal to the last digit of your student number, na be a number equal to the last two digits of your student number. That is, if the last two digits of your student number is 83 then, n = 3, n2 = 83. Consider the predator-prey equations: dx =ax - bxy...

  • Problem 1 Write a BASH script to create a user account from the Linux system on...

    Problem 1 Write a BASH script to create a user account from the Linux system on which your script is run. The script should process two positional parameters. First positional parameter is supposed to be a string with a user name (e.g., user_name) Second positional parameter is supposed to be a string with a user password (e.g., user_password) In your script: Check if two positional parameters were passed to your script when it was invoked If NOT, print an appropriate...

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