could really use some help with this assignment. I'm not sure where to start. Below is the info given in the lecture to help with the assignment
2 ビュー (過去 30 日間)
古いコメントを表示
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/167531/image.png)
could really use some help with this assignment. I'm not sure where to start. Below is the info given in the lecture to help with the assignment
Default Arguments Example
function [O1, O2] = F1(I1,I2)
if isempty(I1) I1 = 10; end % Assign 10 if empty
if isempty(I2) I2 = 5; end % Assign 5 if empty
or Loop Example from Help
for R = 1:N
for C = 1:N
A(R,C) = 1/(R+C-1);
end
end
% R is the row number from 1 to N
% C is the column number from 1 to N
% Formula for value in array
% end the loop with C
% end the loop with R
for Loops Example with Break
• Very useful for sums and Taylor series
function e = exp1(N)
e = 0;
for k = 0:N
add = 1/factorial(k);
e = add + e;
if add < 1E-10 break; end
end
while Loops • In a while loop, a command or group of commands is executed as long as condition is true
x = 1;
while x <= 15,
x = 2*x;
end
1 件のコメント
Jan
2017 年 9 月 27 日
I cannot even read the screenshot. As usual for homework questions: Please post, what you have tried so far and ask a specific question. The forum should not solve your homework.
回答 (1 件)
Andrew Bliss
2017 年 9 月 27 日
Looks like you've been given everything you need. Post the code you've tried so far and the errors you're getting and you're more likely to get help here.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Loops and Conditional Statements についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!