1)
x = [0:0.05:2*pi];
y1 = sin(x);
y2 = cos(x);
plot(x,y1,'b-o');
hold on;
plot(x,y2,'r-o');
legend('sin(x)','cos(x)','Location','southwest');
set(gca,'XTick',0:pi/2:2*pi);
set(gca,'XTickLabel',{'0','pi/2','pi', '3pi/2','2pi'});
2)
function draw_circle_lastname( x0,y0,R )
th = 0:pi/50:2*pi;
X = R * cos(th) + x0;
Y = R * sin(th) + y0;
H = plot(X, Y);
hold on;
scatter(x0,y0,'r.'); % plot center
str = sprintf('Origin(%d,%d)\n Radius %d',x0,y0,R);
text(x0,y0,str);
axis equal;
hold off;
end
plotcircle.m
fprintf('Enter center of circle\n');
x0 = input('x0: ');
y0 = input('y0: ');
R = input('Enter Radius of Circle: ');
draw_circle_lastname(x0,y0,R);
This uses MATLAB code with plotting HW19: Plotting with plot () Due 11:59 pm Monday 1....
Please show the code necessary, and explanations on MATLAB. Plotting 11) Plot the function y = sin(x) from x = 0 to 21. 12) Plot the functions y = x2 z = x2 + 2x + 1 from x = 0 to 2 on the same graph. Scripts: Input and Output 13) Write a script (M-file) to read in a message at the command line using the MATLAB input function and then display the message to the Command Window using...
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...
In this exercise, you will create a function trough_plot which will plot the cross-section of a trough outlines by the functions y0 and y. Input variables: x – a vector representing the x co-ordinates for the outline of the trough. y – a vector representing the y co-ordinates for the bottom of the trough. y0 – a vector representing the y co-ordinates for the top of the trough. Output variable: n/a – this function has no output variables. Process: The...
CS240 Intro Engineering Programming Programming Assignment # 6 Due Friday, March 29th by midnight Topics: Plot subplot We know that the work done by a force F which is applied on a box at an angle x-axis and a displacement value d is given by: with respect to the and assume we know that d 15 m. Write a function its name is "work calculator" which gets two inputs 1) A vector which includes angle( θ ) values ranges from...
Write a MATLAB Graphical User Interface (GUI) to simulate and plot the projectile motion – the motion of an object projected into the air at an angle. The object flies in the air until the projectile returns to the horizontal axis (x-axis), where y=0. This MATLAB program should allow the user to try to hit a 2-m diameter target on the x-axis (y=0) by varying conditions, including the lunch direction, the speed of the lunch, the projectile’s size, and the...
Please help me with this MATLAB programming problem! Im coding iin MATLAB2018 if that makes any difference! The first picture is the question i need to answer. The picture below is used as reference to answer the question. The last picture (below) is the into to the problem, and is used as reference. 1. Use Matlab to create the following single plot with three subplots. All titles, gridlines, and axis labels should be as shown. Arc System Response 15 E...
please help me with this MATLAB CODE and explain to me what each line does and what is used for? leave your comments as words, not as pictures. ..................................................................................................................................................................... clear all; close all; % For a script file, you better start with clear all and close all % However, for a fucntion, you better NOT to start % with them %% End of cell mode example %% Plot function t = 0:0.1:5; x1 = sin(2*5*t); x2 = cos(3*7*t);...
USE MATLAB ALSO PLOT THE PENDULUM animation Case 1: Pendulum Create a plot that shows a pendulum moving. First,use the ode45 function to solve the pendulum equation between 0 and 10 seconds. The pendulum equation is: Create a plot that shows a pendulum moving First, use the ode45 function to solve the pendulum equation between 0 and 10 seconds. The pendulum equation is: + sin(e) 0 where g is gravity and L is the length of the pendulum bar. Use...
Please help with this MATLAB problem! I'm writing in MATLAB_R2018b if that makes a difference:) 7. Write a Matlab function (HW07 07.m) that takes 4 arguments and returns two arrays. The arguments are the Xc and yc coordinates of the center of a circle, the radius r of the circle, and the number of points n on the circle. The function should create a list of n equally-spaced angle values ranging from 0 to 2n. Then, for each angle value,...
Create a code that performs the following actions: l. Define the flow rate and height of tank 2./ Have the user input a value for radius 3./ Ask the user for a value of many minutes the tank should fill for 4. Clear the command window (clc) after all of the input commands are given 5. Call in a "tank solver" function that performs the following Takes F, h, r, and t final as inputs, and there are no variable...