RMS value of periodic signal - using quad/quad8 command - getting an error with 'func' command
Show older comments
Hi, I'm trying to find the rms value of v(t)=2.5sin(2pi*10^6+30). I have one of my lecturers codes to use as an example but I keep running into the error:
"Undefined function or variable 'func'.
Error in quad (line 67)
y = f(x, varargin{:});"
Iv'e written out identically to him and tried making minor adjustements to fix it but nothing seems to work. Hears his example that we were givin to use.
clc
clear
T=10^(-6);
a=0;
b=T;
int_v_sq=quad('func',a,b);
v_rms_sq=int_v_sq/T;
v_rms=sqrt(v_rms_sq);
function y=func(t)
T=10^(-6);
phase=30;
phase_rad=phase*pi/180;
y=(2.5*sin(2*pi/T*t+phase_rad)).^2;
end
Any help would be much appreciated
Accepted Answer
More Answers (0)
Categories
Find more on Creating, Deleting, and Querying Graphics Objects in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!