フィルターのクリア

conversion frm sym to double is not possible?

2 ビュー (過去 30 日間)
khushi
khushi 2015 年 8 月 22 日
コメント済み: Walter Roberson 2015 年 8 月 22 日
clc;
clear all;
g_db=[0:1:40];
g=10.^(g_db/10);
c=1;
syms y
%g=0:0.1:10;
alpha=1;
p=0.5*((g)+exp(-g.*y));
q=((y.^(alpha-1)).*exp(-y./c))/((gamma(alpha))*(c^alpha));
r=p*q;
semilogy(g_db,r,'o')
hold on
  2 件のコメント
khushi
khushi 2015 年 8 月 22 日
but again error is coming undefined linespace argument for double..plz help
Walter Roberson
Walter Roberson 2015 年 8 月 22 日
linspace not linespace

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

回答 (1 件)

Walter Roberson
Walter Roberson 2015 年 8 月 22 日
Your y is a symbol. p uses y so p is symbolic. q uses y so q is symbolic. Two symbolic values multiplied together is going to be symbolic. Therefore r is symbolic.
You then try to semilogy() with the second argument being that symbolic r. semilogy is not able to plot symbolic results.
In order to plot something that is in symbolic form, all of the symbolic variables in the expression must be given specific numeric values. For example,
semilogy(g_db, double(subs(r,y,linspace(0,1,20)), 'o')

カテゴリ

Help Center および File ExchangeFormula Manipulation and Simplification についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by