Matlab Grader and resample()

1 visualización (últimos 30 días)
Greg Watkins
Greg Watkins el 1 de Mzo. de 2021
Comentada: Greg Watkins el 1 de Mzo. de 2021
I am trying to use matlab grader with a script that uses the resample function.
The documentation online indicates some aspects of the signal processing toolbox are not available.... but resample() is not mentioned.
Any suggestions appreciated.
Thanks
The code below - copied from a mathworks website -
fs = 10;
t1 = 0:1/fs:1;
x = t1;
y = resample(x,3,2);
t2 = (0:(length(y)-1))*2/(3*fs);
plot(t1,x,'*',t2,y,'o')
xlabel('Time (s)')
ylabel('Signal')
legend('Original','Resampled', 'Location','NorthWest')
causes the following error.
Undefined function 'resample' for input arguments of type 'double'. Error in solution (line 4) y = resample(x,3,2);

Respuestas (1)

Cris LaPierre
Cris LaPierre el 1 de Mzo. de 2021
Editada: Cris LaPierre el 1 de Mzo. de 2021
I assume this is the website example you refer to? It works for me when I create and run the problem in a collection. Have you created your problem in a course?
In courses hosted on grader.mathworks.com, courses initially only have access to base MATLAB. In order to use any of the toolboxes, they must first be added to the course. See the Select Products for Courses page for instructions on how to do this. Once you add the Signal Processing toolbox, you should be able to run the code without an error.
As an aside, collections have access to all toolboxes. You can use a collection to create a repository of problems that you can then draw on it to build a course. You'll stil have to add the products to the course for students to solve the problems, but it can make the creation process a little easier. For more on this, see Ch 6.2 of Teaching with MATLAB.
  1 comentario
Greg Watkins
Greg Watkins el 1 de Mzo. de 2021
Thanks Cris.
Rookie error. I missed that course option.

Iniciar sesión para comentar.

Community Treasure Hunt

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

Start Hunting!

Translated by