Error using plot Conversion to double from sym is not possible.

1 回表示 (過去 30 日間)
konatham raja sekhar
konatham raja sekhar 2020 年 2 月 13 日
コメント済み: KSSV 2020 年 2 月 16 日
clc;
clear all;
syms x k po;
a=3;
%x=[0:a/10:a];
y=3;
r=input('enter how many you want');
n=16*y/(pi^2*(2*k-1));
po = symsum(n*sin((2*k-1)*pi*x/2),k,1,r)
x=[0:0.1:3];
plot(x,po,'-');
while executing the code I am getting the error saying double to syms not possible. Can any one answer me?

回答 (1 件)

KSSV
KSSV 2020 年 2 月 13 日
編集済み: KSSV 2020 年 2 月 13 日
YOu have po to be symbolic element. YOu need to substitute x and get the value in double and plot.
clc;
clear all;
syms x k po;
a=3;
%x=[0:a/10:a];
y=3;
r=input('enter how many you want:');
n=16*y/(pi^2*(2*k-1));
po = symsum(n*sin((2*k-1)*pi*x/2),k,1,r)
x=[0:0.1:3];
% get value of po substututing x
P = double(subs(po,x)) ;
plot(x,P,'-');
  2 件のコメント
konatham raja sekhar
konatham raja sekhar 2020 年 2 月 16 日
Hii @KSSV
Thank you very much for your answer. Its working
KSSV
KSSV 2020 年 2 月 16 日
Thanks is accepting the answer.

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

カテゴリ

Help Center および File ExchangeNumber Theory についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by