The following error was reported evaluating the function in FunctionLine update: Unable to convert expression containing remaining symbolic function calls into double array

4 ビュー (過去 30 日間)
Hello,
I am trying to plot a signal using the fourier function.I dont know how to solve it or if i do something wrong.This is my code:
syms t w;
% Define the first signal u(t)-u(t-2) using the heaviside function
x1 = heaviside(t) - heaviside(t-2);
% Define the second signal u(t)-u(t-4)
x2 = heaviside(t) - heaviside(t-4);
%Multiply the signals
Z = fourier(x1) .* fourier(x2);
% Compute the convolution in the time domain
signal_in_time = ifourier(Z);
%display the graph:
figure(1);
fplot(signal_in_time);

採用された回答

Walter Roberson
Walter Roberson 2023 年 10 月 20 日
syms t w;
% Define the first signal u(t)-u(t-2) using the heaviside function
x1 = heaviside(t) - heaviside(t-2);
% Define the second signal u(t)-u(t-4)
x2 = heaviside(t) - heaviside(t-4);
%Multiply the signals
Z = fourier(x1) .* fourier(x2)
Z = 
% Compute the convolution in the time domain
signal_in_time = ifourier(Z)
signal_in_time = 
Notice that this has unresolved fourier() calls -- places that the inverse fourier has trouble handling.
What can you do? Well you can use the laplace transform instead.
Z2 = laplace(x1) .* laplace(x2)
Z2 = 
signal_in_time2 = ilaplace(Z2)
signal_in_time2 = 
fplot(signal_in_time2)

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSpectral Measurements についてさらに検索

製品


リリース

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by