Can someone help me with the code to plot this

Can someone tell me how to plot this function on matlab. Every time I input the function and try plotting, the graph does not look right.

2 件のコメント

John D'Errico
John D'Errico 2017 年 7 月 6 日
Show what you tried. Otherwise, you are just asking us to do your homework for you.
Ziv Melamed
Ziv Melamed 2017 年 7 月 6 日
編集済み: Walter Roberson 2017 年 7 月 6 日
>> x=[0,1];
>> y1=sqrt((sin(x).^2)+exp(-(x/2)))
y1 =
1.0000 1.1466
>> plot(x,y1)

回答 (1 件)

Walter Roberson
Walter Roberson 2017 年 7 月 6 日

0 投票

x = linspace(0,1);

4 件のコメント

Ziv Melamed
Ziv Melamed 2017 年 7 月 6 日
Is the y1 function I originally entered correct? When comparing it to the the image which shows the f(x) function.
Walter Roberson
Walter Roberson 2017 年 7 月 6 日
You missed a .^2 inside the exp()
Les Beckham
Les Beckham 2017 年 7 月 7 日
You should check your parentheses also. As written, you are taking the square root of the entire expression instead of just the sin^2(x) portion.
Walter Roberson
Walter Roberson 2017 年 7 月 7 日
Good catch, Les.

この質問は閉じられています。

質問済み:

2017 年 7 月 6 日

閉鎖済み:

2021 年 8 月 20 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by