can anybody please tell me the use of 'val' function in this program.., it is not a valid function,yet the program can't be executed without using this,or by changing the function name.

30 views (last 30 days)
% Load original 1D signal.
clc;
clear all;
close all;
ELEVATED=[]
[fname path]=uigetfile('*.mat');
fname=strcat(path,fname);
load(fname );
z=zeros(100,1);
A=val(1,:)
v1=val(1,:)-val(1,1)
A=v1
A=A'
zc=A(1)
A=[z;A;z]
% s = A(1:1:400);
s = A;
ls = length(s);
figure(1)
plot(s);
title('Actual Signal'),grid on
[c,l]=wavedec(s,4,'db4');
ca1=appcoef(c,l,'db4',1);
ca2=appcoef(c,l,'db4',2);
ca3=appcoef(c,l,'db4',3);
ca4=appcoef(c,l,'db4',4);
figure(2)
plot(c),title('decomposed signal'),grid on
figure(3)
subplot(2,2,1)
plot(ca1),title('1st level reconstructed'),grid on
subplot(2,2,2)
plot(ca2),title('2nd level reconstructed'),grid on
subplot(2,2,3)
plot(ca3),title('3rd level reconstructed'),grid on
subplot(2,2,4)
plot(ca4),title('4th level reconstructed'),grid on

Accepted Answer

Kye Taylor
Kye Taylor on 19 Mar 2013
Edited: Kye Taylor on 19 Mar 2013
The lines
[fname path]=uigetfile('*.mat');
fname=strcat(path,fname);
load(fname );
will load a .mat file into the scope of MATLAB environment. That .mat file must contain a variable whose name is val. You likely do not have the .mat file in the right place on your machine, if at all.

More Answers (1)

Walter Roberson
Walter Roberson on 19 Mar 2013
In the above, "val" is not a function: it is a variable being loaded from the .mat file.

Community Treasure Hunt

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

Start Hunting!