Question

1.1 Part 1 First, learn how to create a function in MATLAB. Given the function U(T) = 0.12 – 2 sin(1) Create a MATLAB functiohow to do the fun1.m function?

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

Solution: Code: fun1.m” file: %Function definition %fun1.m function u=myFunction(x) %calculation u=exp(0.1*x)-2*sin(x); %Plo

Copyable Code:

fun1.m” file:

%Function definition
%fun1.m
function u=myFunction(x)
%calculation
u=exp(0.1*x)-2*sin(x);
%Plot the function
plot(x,u)
end

gs1.m” file:

%gs1.m
%Main function
x=[0:10];
%Call the function
myFunction(x);

Add a comment
Know the answer?
Add Answer to:
how to do the fun1.m function? 1.1 Part 1 First, learn how to create a function...
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
  • in matlab please 1. (44 points): Given the equations u, v, and w: create a function...

    in matlab please 1. (44 points): Given the equations u, v, and w: create a function file that has u, v, and was outputs and for inputs b and t. Given that t is osts with At = and bis 10 < b < 30 with Ab = 1. Plot the results of u vs. v vs. w all on the same 3D plot. (Hint: Use a for loop to call the function file and have the outputs of the...

  • Objective: Learn how to -- read string from a file -- write multiple files Problem: Modify...

    Objective: Learn how to -- read string from a file -- write multiple files Problem: Modify the Person class in Lab #4. It has four private data members firstNam (char[20]), day, month, year (all int); and two public member functions: setPerson(char *, int, int, int) and printInfo(). The function setPerson sets the first name and birthday in the order of day, month and year. The function printInfo prints first name and birthday. But it should print the date in the...

  • Based on your understanding of function M-file, create a function that can compute the volume of...

    Based on your understanding of function M-file, create a function that can compute the volume of a cylinder. Execute your function file for (radius, height) values of (2,5), (3,7) and (5,10) Can someone help me with this? It is for Matlab.

  • MUST BE WRITTEN IN C++ Objective: Learn how to define structures and classes, create and access...

    MUST BE WRITTEN IN C++ Objective: Learn how to define structures and classes, create and access a vector of structures, use sort with different compare functions. Assignment: Your program will use the same input file, but you will print the whole book information, not just the title. And, most importantly, this time you will take an object oriented approach to this problem. Detailed specifications: Define a class named Collection, in which you will define a structure that can hold book...

  • MUST BE WRITTEN IN C++ Objective: Learn how to define structures and classes, create and access...

    MUST BE WRITTEN IN C++ Objective: Learn how to define structures and classes, create and access a vector of structures, use sort with different compare functions. Assignment: Your program will use the same input file, but you will print the whole book information, not just the title. And, most importantly, this time you will take an object oriented approach to this problem. Detailed specifications: Define a class named Collection, in which you will define a structure that can hold book...

  • can you show how the model would look like on matlab ? please help with this...

    can you show how the model would look like on matlab ? please help with this question For the circuit given below, find the normal form for the inductor current and capacitor voltage. Use Matlab (Create an.m file. Use Isim function) and Simulink (Create a Simulink Model). Plot the responses x1 and x2 over time from the M file and Simulink Model. Do they match? Please explain. Use f(t)-e-cos(2t)u(t) for the input. Assume Zero Initial Conditions. 2Ω I H On...

  • can you show how the model would look like on matlab ? please help with this question For the circuit given below, find the normal form for the inductor current and capacitor voltage. Use Matlab (...

    can you show how the model would look like on matlab ? please help with this question For the circuit given below, find the normal form for the inductor current and capacitor voltage. Use Matlab (Create an.m file. Use Isim function) and Simulink (Create a Simulink Model). Plot the responses x1 and x2 over time from the M file and Simulink Model. Do they match? Please explain. Use f(t)-e-cos(2t)u(t) for the input. Assume Zero Initial Conditions. 2Ω I H On...

  • Reading and Writing Complete Files in C: The first part of the lab is to write...

    Reading and Writing Complete Files in C: The first part of the lab is to write a program to read the complete contents of a file to a string. This code will be used in subsequent coding problems. You will need 3 functions: main(), read_file() and write_file(). The main function contains the driver code. The read_file() function reads the complete contents of a file to a string. The write_file() writes the complete contents of a string to a file. The...

  • use MatLab to answer these questions 1. (10 points) Create an m-file called addup.m Use a...

    use MatLab to answer these questions 1. (10 points) Create an m-file called addup.m Use a for loop with k = 1 to 8 to sum the terms in this sequence: x(k) = 1/3 Before the loop set sumx = 0 Then add each term to sumx inside the loop. (You do not need to store the individual values of the sequence; it is sufficient to add each term to the sum.) After the loop, display sumx with either disp()...

  • I'm a bit confused on how to get this program to run right. Here are the...

    I'm a bit confused on how to get this program to run right. Here are the directions: Part 1: Write a Python function called reduceWhitespace that is given a string line and returns the line with all extra whitespace characters between the words removed. For example, ‘This line has extra space characters ‘  ‘This line has extra space characters’ Function name: reduceWhitespace Number of parameters: one string line Return value: one string line The main file should handle the...

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