MATLAB爱好者论坛-LabFans.com

MATLAB爱好者论坛-LabFans.com (https://www.labfans.com/bbs/index.php)
-   MATLAB论坛 (https://www.labfans.com/bbs/forumdisplay.php?f=6)
-   -   [MATLAB基础] 说是少了个括号,可怎么看都没少 (https://www.labfans.com/bbs/showthread.php?t=20586)

danboby 2013-12-20 14:37

说是少了个括号,可怎么看都没少
 
clear
close all

v12=0.7; v13=1.1 %定义V12和V13的值

F=@(x) (x*(sqrt(v12^2-x^2)+sqrt(v13^2-x^2))./...%定义函数F(x)
(x^2-sqrt(v12^2-x^2)*sqrt(v13^2-x^2)));

figure(1) %新的作图
subplot(1,2,1) %子图1
ezplot(@tan,[0,1.5*pi,-5,5]) %做出正切函数tan(x)的曲线
hold on
ezplot(F,[0,1.5*pi,-5,5]) %做出函数F(x)的曲线
title(['Graphical solution of the eigenvalue: v {12}=',...
num2str(v12),'v {13}=',num2str(v13)])
xlabel('\kappa d')
v=0.7; %定义v的值
F=@(x) (2*x*(sqrt(v^2-x^2))./(2*x^2-v^2); %定义函数F(x)

subplot(1,2,2) %子图2
ezplot(F,[0,1.5*pi,-5,5]; %做出函数F(x)的曲线
hold on
ezplot(F,[0,1.5*pi,-5,5]) %做出函数F(x)的曲线
title(['Graphical solution of the eigenvalue: v=v {12}=v{13}=',...
num2str(v12)])
xlabel('\kappa d')

danboby 2013-12-20 14:38

回复: 说是少了个括号,可怎么看都没少
 
F=@(x) (2*x*(sqrt(v^2-x^2))./(2*x^2-v^2); %定义函数F(x)

就这句话报错,Unbalanced or unexpected parenthesis or bracket.


所有时间均为北京时间。现在的时间是 08:45

Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.