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

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

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 (nargin

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!