Plotting matrix with anonymous function

5 ビュー (過去 30 日間)
leon leon
leon leon 2014 年 8 月 12 日
編集済み: Azzi Abdelmalek 2014 年 8 月 12 日
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 Center および File ExchangeMATLAB についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by