Please show the code necessary, and explanations on MATLAB.
11) Plot function y=sin(x)
% define x
x=[0:0.1:2*pi];
% compute y
y=sin(x);
% open a figure window and plot x and y
figure
plot(x,y);
xlabel('elements in vector x from 0 to 2pi');
ylabel('elements in vector y=sinx');
title ('The sine function from 0 to 2pi');
grid on,axis equal
12) Plot function y=
% define x
x=[0:0.1:2];
% compute y
y=x.^2;
% open a figure window and plot x and y
figure
plot(x,y);
hold on
%compute z
z= x.^2 + 2*x +1;
plot(x,z);
legend({'y=x.^2','z= x.^2 + 2*x +1'},'Location','southwest')
hold off
grid on, axis equal
M-script to read message from command line using input function.
displays the text in x
= input(prompt
)prompt
and waits for the user to
input a value and press the Return key.
returns the entered text, without evaluating the input as an
expression.str
= input(prompt
,'s')
using input function without 's'
displays the text in x
= input(prompt
)prompt
and waits for the user to
input a value and press the Return key.
It will display output with a syntax error.
Please show the code necessary, and explanations on MATLAB. Plotting 11) Plot the function y =...
This uses MATLAB code with plotting HW19: Plotting with plot () Due 11:59 pm Monday 1. (10 pts) Write a script that will produce a sine curve and a cosine curve in the same plot, 0 as shown to the right. 06 0.4 0.2 To have two sets of data in one plot, you may plot the first one, then with the command hold on", plot the other. Or, you can learn how to plot two lines with just one...
Question 1: Creating a user-defined function Write a user-defined MATLAB function named PBTask4pl_f.m for the following math function with x the input argument and y the output y(x)=0.8x4-13x2-5x The function should work for x being a scalar or a vector. Write a script file named PBTask4pl.m to a) Use the function to calculate y(3) and y(5) and display the results in command window b) Use the function to make a plot of the function y(x) for -5:5: x 5:5. Label...
Please use matlab cars. Answer: Function file; Command Window: 5.4 Write a user-defined function that plots a circle given the coordinates of the center and the radius. For the function name and arguments use circleplot(x,y,R). The input arguments are the and y coordinates of the center and the radius. Use linspace to generte the angle from 0 to π with 100 points. (Hint: the circle equation: x+Rcos and yy-yRsin 0.) This function has no output arguments. Plot the circle using...
MATLAB Problem HW7P2 (20 points) (5 pts) Write a user-defined MATLAB function called HW7P2_fn for the following math function 3 o-0.47x The input to the function is x and the output is y. Write the function such that x can be an array (use element-by-element operations) (15 pts) Use the function in (a) the command window to calculate y(-2) and y(5) (b) a script file HW7P2.m to determine y(x) for 0.001 Sx S 10 with 1000 points. Hint: Use the...
write a matlab code Write a MATLAB function to check the stability of a digital filter described by its coefficients. Syntax: stable (b, a); where b and a are the system's forward and backward coefficient. Hint: The roots() function might be useful. Returned value: None. Operation: Displays either 'Stable' or 'Not Stable' message and plots the z-plane. Test with Case#1: y(n)= 2x (n) +x (n-1) +0.4y (n-1) - 0.6y (n-2) Case#2: y(n)= x(n) +0.5x (n-1) +2x (n-2)- y(n-1) +y (n-2)...
Develop a MATLAB script (M-File) to plot the function: y(x)-2l0g(10x) for the range of 0 sxs 10.
The matlab code for the following problem is appreciated!! QUESTION 3 Write a function fnfr_plot that will receive two function handles from elementary math functions which accept a vector to first sort in ascending order then calculate. The script will display the results in two separate Figure Windows with the function names in the title. Submit: fnfr_plot.m Browse My Computer Attach File QUESTION 4 Generate 1x100 random vector, x in the range of 0<x<100 by using rand. Input 2 elementary...
Please read the instructions carefully and show me the matlab code in detail and the graph For all the questions below, whenever necessary, use a time resolution of 10ms for your time axis and plot in the range t 10,10]. Matlab hint for time axis: t [0:0.01:101 Remember your script should be self-sufficient and run without any errors to receive any points. Question 1. Find the impulse response h(t) for the LTIC system (1) provided below, using Matlab's built in...
Function / File Read (USING MATLAB) A) create a user-defined function : [maxsample , maxvalue , numsamples]=writetofile(sname,strgth) to do the following: The user-defined function shall: -Accept as the input a provided string for the sample name (sname) and number for strength (strgth) - open a text file named mytensiledata.txt, with permission to read or append the file. - Make sure to capture any error in opening the file - Write sname and strgth to the file - Close the file...
Using MATLAB Linear Interpolation: The following equation illustrates how to calculate an output for any input, using linear interpolation. The input must be within the bounds of the data set. The constants come from the data set; they are the nearest data points that bound the original input. (constants from data set--> y1, x1, y2) (output--> y) (input--> x) Create a MATLAB function file that calculates the linearly interpolated y-value (output) provided an x-value (input). The function should linearly interpolate...