Question
Need Help writing a main script MATLAB CODE function [x,y,z] = cylinder2(profile,AxisVals,NumChords,UseAxis) % Like the built-in function cylinder, but with specification of the values %
Need Help writing a main script MATLAB CODE
function [x,y,z] = cylinder2(profile,AxisVals,NumChords,UseAxis) % Like the built-in function cylinder, but with specification of the values % of the axis points along which the profile is to be plotted. If called % with only the profile argument, this will be identical to cylinder, using % axis values from 0 to 1. If AxisVals is specified, it must be of the same % length as profile. NumChords is the number of azimuthal points about the % axis to use (default 17). If UseAxis is specified, it is a string with % values 'x', 'y', or 'z' (default) and that axis will be used as the axis % along which the profile is plotted.
% cyl defaults if (nargin
az = linspace(0,2*pi,NumChords); % azimuth for zind = 1:length(AxisVals) x(zind,:) = profile(zind)*cos(az); y(zind,:) = profile(zind)*sin(az); z(zind,:) = AxisVals(zind)*ones(size(x(zind,:))); end
% take care of 'x' or 'y' axis profiles if (UseAxis=='x') temp = x; x = z; z = temp; elseif (UseAxis=='y') temp = y; y = z; z = temp; end
% if the output arguments aren't given, plot if (nargout==0) surf(x, y, z); end
function [x, y,z] - cylinder2 (profile, AxisVals, NumChords, UseAxis) % Like the built-in function cylinder, but with specification of the values % of the axis points along which the profile is to be plotted. If called % with only the profile argument, this will be identical to cylinder, using % axis values from 0 to I. If Axisvals is specified, it must be of the s % length as profile. NumChords is the number of azimuthal points about the % axis to use (default 17). If UseAxis is specified, it is a string with % values 'x', 'y', or 'z' (default) and that axis will be used as the axis % along which the profile is plotted. cyl defaults if (narginStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started