symprod error

조회 수: 3 (최근 30일)
Ima
Ima 2012년 2월 14일
편집: Cedric 2013년 10월 20일
The goal of the code above is to create a pre-specified number of vortices, denoted by the entries V(i). The vortices are in complex form (i.e. x+i*y etc). I would like to be able to take the symbolic product of the vortices (specified by the parameter vort_num).
For example: if I have 2 vortices V = [ x + y*i, x - 1 + y*i], then I would like psi_0 to be their symbolic product. The only problem is that I would like to be able to change the number of vortices easily, so I was trying to use the symprod function. This way I could easily expand from 2 vortices to 10,so on and so forth.
This is not working: I am getting the follow error:
??? Undefined function or method 'symprod' for input arguments of type 'sym'.
The code is:
clc;
clear;
syms x y t k;
vort_num = 2 %Set number of vortices
A = ones(vort_num,3); %Construct a 3 row matrix consisting of each vortex parameter (A(row1),B(row2),E(row3))
V = sym(ones(1,vort_num));
for k = 1:vort_num
A(k,3)=k-1 %Set displacement to be equal between each vortex, moving in the positive direction on the x-axis for each new vortex
V(k) = A(k,1)*(x-A(k,3))+i*y*A(k,2) %Create complex form of each vortex
end
psi_0 = symprod(V(k), k, 1, vort_num); %Expand initial solution in polynomial form
I tried to change V to a symbolic matrix, but I am still having some issues.
Any help that you could provide could be extremely helpful.
Thanks Ima
  댓글 수: 2
Walter Roberson
Walter Roberson 2012년 2월 14일
Which MATLAB version are you using?
Ima
Ima 2012년 2월 15일
Oh - sorry:
7.12.0.635 (R2011a) student version.

댓글을 달려면 로그인하십시오.

답변 (3개)

Kai Gehrs
Kai Gehrs 2012년 3월 5일
Hi Ima,
the function SYMPROD was introduced in R2011b.
In addition to that the function SYMPROD is for computing products of a (scalar) expressions.
Something like
>> syms k;
>> symprod(1/k,k,1,inf)
is the use case for this function.
But you should be able to work around the problem as follows: I think you want to use PROD (which is the symbolic overload of the usual MATLAB function for computing products) anyway.
Something like
psi_0 = prod(V)
should do the job (if I undertood you correctly). You can change the size of V to get the product of less or more elements.
Maybe this helps a bit.
Best regard,
-- Kai

Andrew Newell
Andrew Newell 2012년 2월 17일
Are you sure you have the Symbolic Toolbox? Try typing ver and see if it is one of the ones listed.
If it is listed, maybe it isn't checked out. See How would one check for installed MATLAB toolboxes in a script/function?
  댓글 수: 2
Ima
Ima 2012년 2월 17일
It says that I have the symbolic math toolbox version 5.6. Is this the right one?
Andrew Newell
Andrew Newell 2012년 2월 17일
I think so. See above for another suggestion.

댓글을 달려면 로그인하십시오.


Ima
Ima 2012년 2월 22일
It appears that the license is properly checked out. I ran this in Matlab:
license checkout symbolic_Toolbox
ans =
1
Could something else be causing the problem?
Thanks Ima
  댓글 수: 1
Andrew Newell
Andrew Newell 2012년 2월 22일
Strange. I have added some more suggestions to my answer.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Calculus에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by