Question

MATLAB QUESTION. function [output1,output2] = myFunction(a,b) output1 = a*5; output2 = output1*10; end Then I have...

MATLAB QUESTION.

function [output1,output2] = myFunction(a,b)

output1 = a*5;

output2 = output1*10;

end

Then I have a script with values for a and b. How can I call the previous function so that i get output2?

a=10;

b=10;

(How can I get output 2?)

it has to run as a script

0 0
Add a comment Improve this question Transcribed image text
Answer #1
function [output1,output2] = myFunction(a,b)
    output1 = a*5;
    output2 = output1*10;
end

Function call using below code:
-----------------------------------
a=10;
b=10;
[output1,output2] = myFunction(a,b);
disp(output2);

500

Add a comment
Know the answer?
Add Answer to:
MATLAB QUESTION. function [output1,output2] = myFunction(a,b) output1 = a*5; output2 = output1*10; end Then I have...
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
  • MATLAB HELP : Create a MATLAB function starting as follows:- Function [root1,root1] = quadraticroots (a,b,c) to...

    MATLAB HELP : Create a MATLAB function starting as follows:- Function [root1,root1] = quadraticroots (a,b,c) to find the roots of a quadratic function. To test your function find the roots of the following equation:- X^2+5x+6=0 Submit the complete listing and results of a run with the variable a=1,b=5 and c=6. Your file should contain at least the following:- Purpose of the function, Description of the input and output variables, Call statement(s), PLEASE SHOW FULL SCRIPT OF THE MATLAB with results...

  • I have created a function (lets call it function A) in MATLAB that uses 'for loop'...

    I have created a function (lets call it function A) in MATLAB that uses 'for loop' to create a 3*4 matrix. I am creating another MATLAB function (lets call it function B) that has absolutely no relation with function A but needs to use the matrix from function A. How do I call only the matrix from function A to function B such that as this matrix changes in function A it triggers corresponding changes in function B as well?...

  • Matlab Homework Please write a script that does the following: generates a 3 x 5 matrix...

    Matlab Homework Please write a script that does the following: generates a 3 x 5 matrix of random integersand call it A. generates a 3 x 3matrix of random integers and call it B. "Fix" A so it can be compared to B How do we "Fix" A? Make sure to reassign the value to A Tell me how many elements of A are greater than or equal to B This can be done in a single line. You will...

  • matlap Question 1 1. Consider the following Matlab program 5 - (2 < 3) & (C2...

    matlap Question 1 1. Consider the following Matlab program 5 - (2 < 3) & (C2 > 3) 1 (1 - 0)) What is the final value of s? A. True B. *1 CO D. false 2- Which expression tests whether variable x is between (but not the same as) the values 5 and 10 (a) 5 <x< 10 (b) 5 <= x <= 10 (c) 5 < X & X > 10 (d) x < 10 & 5 <...

  • MATLAB Question: Write a script for the problem pictured. Please send the script, not just the...

    MATLAB Question: Write a script for the problem pictured. Please send the script, not just the printout. Make sure your script allows you to input a value for n so when prompted, in the command window, user types n value. The n value should be the f_k if k ==1 .... Please also send print outs if you can. BELOW IS A SAMPLE ANSWER THAT DID NOT PUT THE INPUT SCRIPT NEEDED FOR THIS QUESTION TO BE CORRECT. YOU CAN...

  • Matlab Question (Matlab Grader) Where indicated at the bottom of the script. write a function, called...

    Matlab Question (Matlab Grader) Where indicated at the bottom of the script. write a function, called isright, that takes three inputs, a, b, and c, and determines whether they are could be the lengths of the sides of a right triangle; the output, y, will be set equal to the following: i). -1 if at least one of the values is not positive. Also, only for this case, have the function print out an error message, which states "At least...

  • Matlab Question Only do parts c, d, and g. Parts a and b are for reference....

    Matlab Question Only do parts c, d, and g. Parts a and b are for reference. This is a Matlab Question (Multipart-I already got someone to do a and b but they said I need to use another one of my questions to get c,d and g answered). The Maclaurin series expansion for e^x is e^x=1 + x/1! + x^2/2! + x^3/3! +x^4/4!... and it can be expressed in summation form as e^x = x^(k-1)/((k-1)!) The MATLAB function [exVal]=findEX(x,n) shown...

  • For this question you need to create a function in Octave called MyFunction that accepts two...

    For this question you need to create a function in Octave called MyFunction that accepts two inputs, a list L and an integer K, and returns two values minsum and maxsum. A template function including the function prototype (first line) has already been created for you to use (do not change this). I will only mark the contents of the MyFunction.m file. Any code added to the main.m file is for your testing only and will not be marked. Your...

  • 5.i) What will be the output of the script: for i-1:7 for j- 1:i fprintf(%d", j)...

    5.i) What will be the output of the script: for i-1:7 for j- 1:i fprintf(%d", j) end fprintf('\n') % start a new line. end 5 (i) For ax2 + bxc 0, the value of x is given by 2a Write a MATLAB function quadrasol () that will have three inputs ( a,b, and c) and two outputs corresponding to the solutions of the equation. It may be more compact if you defined another variable 'd' for the term inside the...

  • This is a MATLAB Question. Below is my base code for a Fourier Series of a...

    This is a MATLAB Question. Below is my base code for a Fourier Series of a half triangle wave. So I am being asked to isolate the first 8 components so that only those first 8 components of the half triangle function are calculated by MATLAB fft function, and then afterwards I am asked to do the same thing but with the first 20 components rather than the first 8. How do I isolate the first x number of components...

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