ارجو منكم المساعده بسرعه جزاكم الله خير

السلام عليكم

اعضاء منتدى المهندس
ارجوا منكم جميل الرجاء
انكم تحلون لي هذا التمرين لانه لما استطيه حله
وجزاكم الله خير الجزاء وانا معتمده على الله ثم عليكم
اريده اليوم

[LEFT]Write a MATLAB function M-file to test the value of [FONT=Tahoma][COLOR=#c10000]n[/left]
[/color][/font][LEFT]If n = 1[/left]
[LEFT]Add n to itself once[/left]
[LEFT]otherwise[/left]
[LEFT]Add n to itself n times[/left]

Notes:

[LEFT]Name your function MyFun[/left]
[LEFT][FONT=Tahoma][COLOR=#c10000]n [/color][/font]should passed to the function as an argument[/left]
[LEFT]The function should return an argument named [FONT=Tahoma][size=4][COLOR=#c10000]result[/left]
[/color]
[/font][/size]

clc
clear
n=input('enter the value n ')l
if n==1
result=n+n
else
result=n*n
end

هذا هو الكود
بعد أن تطبعه الى M-file
شطب اخر حرف من السطر الثالث
وبعدها save as
وسميه myfun
,وحياكم الله