help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: What should I do to fix "warning: implicit conversion from real matr


From: John B. Thoo
Subject: Re: What should I do to fix "warning: implicit conversion from real matrix to real scalar"?
Date: Wed, 8 Jul 2009 11:06:47 -0700


On Jul 8, 2009, at 8:12 AM, Carlo de Falco wrote:


On 8 Jul 2009, at 16:25, John B. Thoo wrote:

1;

function y = h (x)

load ht_tf8M160ord9visc01.mat u;
x = u(:,5);

  y = x.^2;

endfunction

quad ("h", 0, 1)

the integrand function you pass to quad should return a scalar output when given scalar input while your function h always returns THE SAME vector ( u(:,5).^2 as stored in the file ht_tf8M160ord9visc01.mat ) regardless of the input.
c.

Hi, Carlo. Thanks for the tip. So, then, is using "trapz" in the following way my only recourse to find \int H(u(:,t)) dx for some function H(x) where u(x,t) is a matrix?

%%--------begin energy.m---------
clear all

global u;
load ht_tf8M160ord9visc01.mat;

function y = h (x)
global u;

  U = u(:,5);
  y = (U.^2).';

endfunction

trapz (x, h (x))
%%---------end energy.m----------

Or is there a way I can use either "quad" or "quadl"?  Thanks again.

---John.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]