why is my plot not working
1 回表示 (過去 30 日間)
古いコメントを表示
I have copied the format of plot code directly, but it doesnt like my equation. I have tried everything I know please help, im dying.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/584376/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/584381/image.png)
0 件のコメント
採用された回答
David Hill
2021 年 4 月 15 日
t=1:10;
F=1./(4.^t)-1./(5.^t);
plot(t,F);
2 件のコメント
Daniel Pollard
2021 年 4 月 15 日
This works because of the . used before each operation. In your code, you tried
1/4^x
which the matlab code interprets as you trying to raise a number (4) to the power of a vector, x. That doesn't really work in normal mathematics, and MATLAB would have thrown an error.
David's code instead writes
1/4.^x
which MATLAB reads to mean "for each element xi in x, calculate 1/4^xi". This is what you intended and is the usual way of calculating values for plotting.
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!