Question

10) you will run/call the function with these given values. (b) Write a flow chart and the script file using conditional stat
0 0
Add a comment Improve this question Transcribed image text
Answer #1

MATLAB Script File:

close all
clear
clc

fprintf('y(x = -5) = %f\n', func(-5))
fprintf('y(x = 3) = %f\n', func(3))
fprintf('y(x = 15) = %f\n', func(15))

function y = func(x)
if x < -1
y = exp(-x+1);
else
if x >= -1 && x < 5
y = 2*sin(pi*x);
else
if x >= 5
y = 10*(x-5)+1;
end
end
end
end

Output:

y(x = -5) = 403.428793
y(x = 3) = 0.000000
y(x = 15) = 101.000000

Add a comment
Know the answer?
Add Answer to:
10) you will run/call the function with these given values. (b) Write a flow chart and the script file using conditional statements with logical operator if/else and if/elseif, to evaluate the fo...
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
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