Error using Quiver function

2 ビュー (過去 30 日間)
Bajinder Singh
Bajinder Singh 2020 年 9 月 19 日
コメント済み: Bajinder Singh 2020 年 9 月 19 日
Hi, I am having an error using Quiver. Below is my code.
[X,Y] = meshgrid(-1:0.1:1, -1:0.1:1);
k=2*pi;
syms U_inf Lambda Psi X Y u v
Psi = U_inf*Y+((Lambda/k)*atan(Y/X));
u = diff(Psi,Y);
v = diff (Psi, X);
quiver (X,Y,u,v)
The error is "Unable to convert expression into double array."
I believe I am not using the syms correctly. Any help is appreciated!

回答 (1 件)

KSSV
KSSV 2020 年 9 月 19 日
You cannot use like that. You need to take all data in double i.e in numbers to plot the arrows.Something like below:
[X,Y] = meshgrid(-1:0.1:1, -1:0.1:1);
k=2*pi;
U_inf = rand ; % define your value
Lambda = 1. ; %define your value
Psi = U_inf*Y+((Lambda/k)*atan(Y./X));
u = gradient(Psi);
v = gradient(Psi);
quiver (X,Y,u,v)
  1 件のコメント
Bajinder Singh
Bajinder Singh 2020 年 9 月 19 日
Thanks for the response. But I am not given any values for U_inf and Lambda. They are simply constants. That is why I was trying to use the "syms" command.

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

カテゴリ

Help Center および File ExchangeLinear Algebra についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by