Variable not saving as a double
조회 수: 1 (최근 30일)
이전 댓글 표시
채택된 답변
Torsten
2023년 3월 11일
You mean
t = 0:1:100;
x = 0.5*exp(2*sin(t))./(10.5*exp(2*sin(t)));
plot(t,x)
(which is equal to 0.5/10.5=0.04761... because exp(2*sin(t)) cancels out) ?
댓글 수: 3
Walter Roberson
2023년 3월 11일
You should avoid using the / operator, except possibly for the case of dividing by a literal constant. The / operator is not the division operator: it is the matrix division operator, with A/B being similar to A*pinv(B) or similar to least-squares regression. Use ./ for the division operator
I would suggest to you that in the cases where you really do want to use matrix division or matrix least-squares that instead of A/B that you use (B'\A')' instead -- the use of \ emphasizes the matrix operation.
t = 0:1:100;
u = 1;
v = 1;
A = 0.1
x = (A.*exp(u.*sin(t))) ./ (1+A.*exp(u.*sin(t)))
M = (1+v.*cos(t).*A.*exp(u.*sin(t))+v.*cos(t)-1) ./ (1+A.*exp(u.*sin(t)));
figure
plot(M,x)
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!