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

Show what you tried. Otherwise, you are just asking us to do your homework for you.
>> 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일
x = linspace(0,1);

댓글 수: 4

Is the y1 function I originally entered correct? When comparing it to the the image which shows the f(x) function.
You missed a .^2 inside the exp()
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.
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