Error typing ^ (power function) on Mac OS

5 ビュー (過去 30 日間)
Denis Bopp
Denis Bopp 2017 年 9 月 28 日
コメント済み: NEIL Alfred 2022 年 1 月 21 日
Hello, when I try to evaluate '^' (power function, like 2^x for example) I recive an error, and the function do not evaluate! I think that is a OS problem, becouse when I type ´^´, it is a small symbol that when I copy and paste from code samples that run.
  4 件のコメント
Lakshman Gandhi
Lakshman Gandhi 2020 年 6 月 14 日
Thanks Denis! Saved my day.
Denis Bopp
Denis Bopp 2020 年 6 月 17 日
:-)

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

回答 (3 件)

Lauri Solja
Lauri Solja 2020 年 1 月 22 日
編集済み: Lauri Solja 2020 年 1 月 22 日
So yeah, I'm having what I think is the same problem. If I type the power formulta to MatLab it gives me the non-ASCII error for the ^ symbol, which looks like a "small power". If I copy a "large power" from lets say this thread everything works. What to do? I dont want to keep the "large power" on my clipboard at all times.
PS. When I type the power in quotes "ˆ" in to this it looks like the small power but if I just type it and press space it becomes large on, like this ^.
Edit. Typing in MatLab with space after the power it changes to large one also.

Steven Lord
Steven Lord 2017 年 10 月 12 日
From where are you copying the code samples? Were they written using a program that tries to do some sort of smart formatting? On those occasions when I've tried to type code into Microsoft Word first, the smart replacement it tried to do ("smart quotes", in particular) have resulted in code that won't run when copied into MATLAB.
What happens if you replace that character with the typed ^ character (Shift-6)? Do you still receive the same error?
  2 件のコメント
Denis Bopp
Denis Bopp 2017 年 10 月 12 日
Thank you for your reply Steven, I wasn't able to execute this command when I simple do shift-6, I need to press space bar after this, if not do this, the command don't is executed and I get an error.
James Tursa
James Tursa 2017 年 10 月 12 日
編集済み: James Tursa 2017 年 10 月 12 日
@Denis: Copy & paste your code into the editor, then manually replace the characters that appear to be ^ with manually typed ^ characters. I.e., physically backspace over them and then type the ^ character. Then run the code.

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


NEIL Alfred
NEIL Alfred 2022 年 1 月 21 日
t = linspace(0, 2*pi, 100);
y= t.^2 * cos(t);
g=sin(t);
figure(1);
plot(t,g)
xlabel('Time,S')
ylabel('Position,M')
grid on
  1 件のコメント
NEIL Alfred
NEIL Alfred 2022 年 1 月 21 日
it keeps displaying an error and wont plot it and says its an error with the t.^2

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

カテゴリ

Help Center および File ExchangeIntroduction to Installation and Licensing についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by