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...

  • 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...

  • 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.

  • 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...

  • 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...

  • 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...

  • 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()...

  • DO THIS IN MATLAB PLEASE DO THIS IN MATLAB Create a script file that performs the...

    DO THIS IN MATLAB PLEASE DO THIS IN MATLAB Create a script file that performs the following calculations. Your script will use the functions you create. Label all graphs appropriately. For this project, do not have your homemade functions fprintf anything, instead have all your fprintf commands within your script. Attach your published script file along with .m files for your functions. Exercise 1. A fundamental iterative method for finding the roots of equations of one-variable is known as Newton's...

  • Please do this in C++. Thank you in advance. Note that you have to carefully create...

    Please do this in C++. Thank you in advance. Note that you have to carefully create your class using the names and capitalization shown below. Put comments into your program, make sure you indent your program properly, and use good naming conventions. Create a class called entry. It should have two private data members of type std::string. One represents a name and the other represents an email address. Make sure you give them ,meaningful names. Create public getters and setters...

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
ADVERTISEMENT