Assume that y is a column vector with ten elements, write matlab code that will create a stem plot of the vector starting at a horizontal axis value of 1. Add code that will create the stem plot of the vector starting at a horizontal axis value of 0. Create additional code that creates a stem plot but plots y at every other horizontal value (i.e., 0, 2, 4, etc)
% Program -1
clc;
close all;
clear all;
y=[0;1;2;3;4;5;6;7;8;9] %column vector with ten elements
x=1:1:10;
stem(x,y);
output:
y =
0
1
2
3
4
5
6
7
8
9
% Program -2
clc;
close all;
clear all;
y=[0;1;2;3;4;5;6;7;8;9]
x=1:1:10;
subplot(2,1,1)
stem(x,y);
x1=0:1:9;
subplot(2,1,2)
stem(x1,y);
output:
% Program -3
clc;
close all;
clear all;
x=0:1:9;
y=2*x;
stem(x,y)
output:
Assume that y is a column vector with ten elements, write matlab code that will create...
please write code in MATLAB as well 5. (12 points) Create the following signal in Matlab: x[n] = u(n) - u[n-6] a. Mathematically compute yi[n] = x[n] * x[n] where * means convolution. Now use the conv command to perform the convolution. Graph x[n) and the resulting y(n), both over the interval Osns 20. How many non-zero terms does y(n) have? Does your computational result agree with the Matlab result? b. Repeat a. but this time with yz[n] = x[n]*h[n)...
Use matlab Answer 12-15 Have code to copy FUNCTIONAL DATA Create a vector of x values from 0 to 207 with a spacing of 7/100, where y= x' sin (x) z= x'COS(x) 12. Create an x-y plot of x and y. 13. Create a polar plot of x and y. 14. Create a three-dimensional line plot of x, y, and z. Be sure to add a title and labels 15. Figure out how to adjust your input to plot3 in...
1) Create a matlab function that calculates: for Name your function TwoVarFunc : The inputs should be in the same order: xmin xmax ymin ymax N: n is the number of elements in the vector x and y The ouputs should be in the same order: f_xy: is the calculated array f(x,y) f_xyMAX: should be the the maximum value of the function f(x,y). Hint: to create vectors x and y look up the matlab built-in function linspace() Hint 2: To...
Need help with this Matlab program %% Exercise 1 % NOTE: Please suppress output--i.e., use a semicolon ';' at the end of any % commands for which the output is not necessary to answer the question. % Delete these notes before turning in. % Define input variable theta as discretized row vector (i.e., array). theta = ??; % Define radius. r = ??; % Define x and y in terms of theta and r. x = ??; y = ??;...
MATLAB Program Problem A projectile is shot at an angle of 50 degrees with respect to the horizontal at a velocity of 200 m/s. Earth's gravity is 9.81 m/s 2. Take the variable x as the range and y as the altitude. Create a MATLAB plot, which plots that trajectory. Now, assume the terrain slopes up by 1 m in y for every 10 m in x. On the same axis, plot the line of the terrain in a different...
Using MATLAB code Assume you have a single row vector stored in a variable. You do not know how many elements are in the vector. Write your own code that sums all the elements in the vector. You are not allowed to use "sum" or any form of loops. (Hint: Use vector characteristics. It will be a single line code.)
Using Matlab; Please show written program to execute and instructions to create plot: 1. Create a vector of x values from 0 to 20 pi, with an increment of pi/100. y=x sin (x) and z= x cos (x) a) create a figure window with two subplots. In first subplot create an x versus y plot and in the second subplot create an y versus z plot. b) create a polar plot of x and y. Add title and labels to...
1) a) Write MATLAB function that accepts a positive integer parameter n and returns a vector containing the values of the integral (A) for n= 1,2,3,..., n. The function must use the relation (B) and the value of y(1). Your function must preallocate the array that it returns. Use for loop when writing your code. b) Write MATLAB script that uses your function to calculate the values of the integral (A) using the recurrence relation (B), y(n) for n=1,2,... 19...
Don't use fplot command. Matlab code. Write out code please, don't make it a screenshot. 2. Use the subplot command to make two plots of the function f(x) = (x + 1)(x - 2)(2x – 0.25) - et one graph for 0 < x <3 and the other for 3 < x < 6. Use a logarithmic scale for the y-axis. Include a plot title (for each subplot), and label both aris(for each subplot).
The following snippet of code will store the r and y coordinates of 10 points in 4 different row vectors and then plots 5 vectors between certain pairs of those points Show/hide Matlab code snippet 1 A-1:5; B A +1/sqrt (2); C = ones(1,5) D C +1/sqrt (2); plot([A; B], [C; D]) axis equal Which of the following statements about the plot produced by the above snippet of Matlab code are correct. The vectors plotted are the vectors from the...