All codes must be entered in matlab Unless specifically stat
All codes must be entered in matlab
Unless specifically stated in a question only allowed Matlab functions can be used.
Allowed functions are; fprintf, input, plot, mesh, surf, contour
Functions allowed in one question are not allowed to answer other questions.
Questions 1. Write a simple program to write -Hello world- to the command window (5 points) 2. Write a program that uses a \'for\' loop to generate a linear array of data from -10 to 10 with an 3. Generate an array of t* using a \'for\' loop and the Matlab dot operator (10 points) 4. Use Matlab\'s randn function to generate an array y of 512 data points having a standard array of 512 data points. Use the parameter t for this array. (10 points) deviation of 1 and a mean of 0. (10 points) Write a \'for\' loop to create a new array ythresh where values in the original array ythat exceed a threshold value of 0.4 are made equal to that value. (30 points) Plot these two data sets against x which is a linear array starting at -10 and finishing at 10 Assuming that both of these parameters are distance measured in millimeters, label your plot (10 points) 5. Write a program to compute the series 1+1 Continue to compute this series until it converges to within 0.00000001. (25 points)Solution
// A Hello world! program in c#.
using system;
namespace Helloworld
{
class hello
{
static void main()
{
Console.WriteLine(\"Hello world!\");
// keep the console window open in debug mode.
Console,WriteLine(\"press any key to exit.\");
Console.Readkey();
}
}
}
