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 回表示 (過去 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
  1 件のコメント
Balsa Markovic
Balsa Markovic 2019 年 5 月 1 日
Thank you Stephane. Do you think everything wiht y1 and y2 is fine?
ps: sorry for bothering

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeAxis Labels についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by