Draw a graphic window vertically in two parts and draw a graphic in the left part functions f1 (x) with dashed line of black color, and in the right function f2 (x) by crosses green color. Observe the variable x in the interval [-pi/4, pi/4] f1(x)=

조회 수: 4 (최근 30일)
Draw a graphic window vertically in two parts and draw a graphic in the left part
functions f1 (x) with dashed line of black color, and in the right function f2 (x) by crosses
green color. Observe the variable x in the interval [-pi/4, pi/4]
f1(x)= sin^4(x^2+1) / (3^x + e^(x+1))^1/3
f2(x)=2e^xlog10(4/x+3) + 1/(x+1)
Here is what i wrote, y1 and y2 i think i made mistake there, but i am nost sure. I would be thankful if you correct me , sorry for bad engilsh.
X= -pi/4:100:pi/4
y1= sin(x^2+1).^4 / (3^x + exp(x+1)).^ (1/3)
y2=2*explog10(4./x+3) + 1./(x+1)
subplot(1,2,1)
plot(x,y1,'--k')
subplot(1,2,2)
plot(x,y2,'xxg')

채택된 답변

Stephane Dauvillier
Stephane Dauvillier 2019년 5월 2일
I assue you don't know the difference between array operator such as .* ./ .^ and matrix operator * / ^
If you have 2 vectors (in your case) and you want to multiply (divide, take the power ) each element of the first vector by the exact same element of the second one, then you definitly don't want to multiply these 2 vectors as it will perform the matrix multiplycation:
with
What you want is the array multiplication
with
For your it will be
y1= sin(x.^2+1).^4 ./ (3.^x + exp(x+1)).^ (1/3)
y2 seems OK

추가 답변 (1개)

Stephane Dauvillier
Stephane Dauvillier 2019년 5월 1일
plot(x,y2,'xg') % one and not 2 x, in the other plot the 2 - mean dashed line one - mean solid line

카테고리

Help CenterFile Exchange에서 Annotations에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by