抑制输出MATLAB [英] Suppressing Output MATLAB

查看:53
本文介绍了抑制输出MATLAB的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的代码输出给出了 if、exact_answer,然后是一个包含 N 个条目的向量输出.我不确定如何抑制该条目.例如,它看起来像下面这样:

My code output gives me if, exact_answer, and then a vector output with N entries. I am unsure how to suppress that entry. For example, it looks like the following:

exact_answer =

    0.2642


If =

    0.1882


ans =

         0    0.1637    0.2681    0.3293    0.3595    0.3679

我不想要答案输出.-

function g = LaplaceTransform(s,N)
        % define function parameters
        a=0; 
        b=1;
        h=(b-a)/N;
        x = 0:h:1;
        % define function
        g = ff(x).*exp(-s*x);

% compute the exact answer of the integral
exact_answer=antiderivative(b,s)-antiderivative(a,s)
% compute the composite trapezoid sum
If=0;
for i=1:(N-1)
    If=If+g(i).*h;
end;
If=If+g(1).*h/2+g(N).*h/2;
If

推荐答案

ans 因为你打电话而出现

LaplaceTransform(bla, blabla)

代替

LaplaceTransform(bla, blabla);

(调用函数时缺少分号).

exact_answer 出现是因为您的线路

exact_answer shows up because your line

exact_answer=antiderivative(b,s)-antiderivative(a,s)

也没有分号,你应该有

exact_answer=antiderivative(b,s)-antiderivative(a,s);

这篇关于抑制输出MATLAB的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆