sin(x)^2
10 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Eth
am 8 Apr. 2019
Kommentiert: John D'Errico
am 22 Nov. 2022
How to expand a function like sin(x)^2 to output 1/2*(1-cos(2*x))? I tried expand(sin(x)^2) but it returns the same.
0 Kommentare
Akzeptierte Antwort
Star Strider
am 8 Apr. 2019
Use the rewrite function:
syms x
ys = sin(x)^2;
ye = rewrite(ys, 'exp')
yc = rewrite(expand(ye), 'cos')
p[roducing:
yc =
1/2 - cos(2*x)/2
2 Kommentare
Weitere Antworten (2)
Hose Orlando
am 3 Aug. 2020
how do i put this matrix into matlab ![]()
1 Kommentar
Walter Roberson
am 3 Aug. 2020
syms A B C
[sin(A)^2, sin(B)^2, sin(C)^2
cos... etc
Carlos Guerrero García
am 22 Nov. 2022
Perhaps the following lines will be useful:
syms x; % Establishing 'x' as a symbolic variable
combine(sin(x)^2,'sincos') % For the 1st (original) question
combine(sin(x)^3,'sincos') % For the last question
1 Kommentar
John D'Errico
am 22 Nov. 2022
Note that combine is a useful tool, but one we see mentioned here rarely. So...
help sym/combine
Siehe auch
Kategorien
Mehr zu Assumptions 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!