Plotting matrix with anonymous function

5 次查看(过去 30 天)
Please need help with this i stuck on this part of the problem.
  1. Now write a plot function that plots t versus y, using mXY.
  2. How do you get the first row of mXY? The second row?
  3. Now plot markers at every 10th sample point, on top of the function plot. Again,use mXY. How do you get every 10th sample point from mXY?
  4. Now create a 2x2 rotation matrix that rotates by 45 degrees.
  5. Multiply mXY by this matrix to create a new matrix, mXYrot.
  6. Plot mXYrot on top of your initial graph.
clear
clc
clf
% Create a matrix and use matric multiplication
% Write an anonymous function for the equation y(t)=t.^2*cos(6*t).
y_Func=@(t)t.^2.*cos(6.*t); % The anonymous function
% The function on the range t=[0,4pi]
t=0:4*pi;
% Generate 40 samples of the function in the range [0,4pi]
ts=linspace(0,4*pi,40);
% Generate 40 samples and create a tSample and ySample array each with 40 points
tSample=ts;
ySample=y_Func(ts);
% Combine tSample and ySample values into a 2 X 40 matrix
mXY=([tSample;ySample]);
plot(mXY,tSample,'r',mXY,ySample,'k')

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 MATLAB 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by