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)=
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Balsa Markovic
am 1 Mai 2019
Kommentiert: Balsa Markovic
am 2 Mai 2019
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')
1 Kommentar
Akzeptierte Antwort
Stephane Dauvillier
am 2 Mai 2019
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
Weitere Antworten (1)
Stephane Dauvillier
am 1 Mai 2019
plot(x,y2,'xg') % one and not 2 x, in the other plot the 2 - mean dashed line one - mean solid line
Siehe auch
Kategorien
Mehr zu 2-D and 3-D Plots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!