Why is my functions not plotting a line?
2 ビュー (過去 30 日間)
古いコメントを表示
My equations is working since i can manually change the variable to obtain different Vbar and Abar values, but it can't plot my graph. I have done this before so i dont know why its not working now. I attached the m' file and is also posting a screen shot.![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/440618/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/440618/image.png)
0 件のコメント
採用された回答
Ameer Hamza
2020 年 12 月 2 日
編集済み: Ameer Hamza
2020 年 12 月 2 日
Change the lines in your code like this
Wcd=(s.*Wab.*(s+sin(theta)))./(1+s.^2+2.*s.*sin(theta));
%^ put a dot here
Acd=(Wab.^2.*s.*cos(theta).*(1-s.^2))./((1+s.^2+2.*s.*sin(theta)).^2);
%^ put a dot here
Read about element-wise operators: https://www.mathworks.com/help/matlab/matlab_prog/array-vs-matrix-operations.html
0 件のコメント
その他の回答 (1 件)
Setsuna Yuuki.
2020 年 12 月 2 日
編集済み: Setsuna Yuuki.
2020 年 12 月 2 日
you need add one point
Wab=9.42;
d=0.12;
s=0.1; % 0.3, 0.6 & 0.9
theta=0:0.1:6.28
Wcd=(s.*Wab.*(s+sin(theta)))./(1+s.^2+2.*s.*sin(theta)); %add point before /
Vbar=Wcd.*d
Acd=(Wab.^2.*s.*cos(theta).*(1-s.^2))/((1+s.^2+2.*s.*sin(theta)).^2);
Abar=Acd.*d
plot(theta,Vbar), grid on;
xlabel('theta(rad)'), ylabel('Acceleration of bar CD(rad/s^2)')
title('Acceleration vs theta @ s=0.1')
0 件のコメント
参考
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!