Question

Problem# 3 1. (10 points) Write a Matlab function called my fun that takes, x as input and generates output. You must use while follows. or iteration. The relationship between x and yisdees output. You must use while lo 50 2n
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Solution:

Matlab code is developed for calculating the sum using while loop. code is appended below.

clear all;
clc;
x=2;
y = my_fun(x);
disp('The value of y is');
disp(y);

-----------------------------------

Function definition

Code:

function y1 = my_fun(x1)
n=50;
sumx1 = 0;
k=1;
while(k<n+1)
sumx1 = sumx1 + x1^(2*k);
k=k+1;
end
y1 = sumx1
end

Results: results obtained for x=2

The value of y is
1.6902e+30

Add a comment
Know the answer?
Add Answer to:
Problem# 3 1. (10 points) Write a Matlab function called my fun that takes, x as...
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