[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: |
Carlo de Falco |
Subject: |
Re: What should I do to fix "warning: implicit conversion from real matrix to real scalar"? |
Date: |
Wed, 8 Jul 2009 21:14:22 +0200 |
On 8 Jul 2009, at 20:06, John B. Thoo wrote:
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?
It is not the only option but it is the safest bet if you
don't know anything else about your data...
%%--------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----------
there's no reason to define a function for calling trapz, you can just
do
%%--------begin energy.m---------
load ht_tf8M160ord9visc01.mat
trapz (x, u(:,5).^2)
%%---------end energy.m----------
Or is there a way I can use either "quad" or "quadl"? Thanks again.
there is no point in using quad or quadl in this case.
c.