matlab

'fplot' plots hidden parameters figure in Matlab


These codes are wrong:

    syms bt;    
    f=415136356873531/(2251799813685248*bt) + 703048105211593/70368744177664
                fplot(@(bt) f,[0.01 1],'b')

But these codes are right:

    syms bt;   
    fplot(@(bt) 415136356873531/(2251799813685248*bt) + 703048105211593/70368744177664,[0.01 1],'b')

Are they not same?


Solution

  • syms bt;    
    f=415136356873531/(2251799813685248*bt) + 703048105211593/70368744177664
    fplot(@(bt) f,[0.01 1],'b')
    

    The syntax is completely wrong here.

    Pass bt to the function f as argument, with syms function just use subs

    @(bt) f   --------> @(bt) subs(f)
    
    syms bt;    
    f=415136356873531/(2251799813685248*bt) + 703048105211593/70368744177664
    fplot(@(bt) subs(f),[0.01 1],'b')
    

    Correct syntax:

    syms bt;    
    f=415136356873531/(2251799813685248*bt) + 703048105211593/70368744177664
    fplot(f,[0.01 1],'b')