vpower.m
来自「JLAB is a set of Matlab functions I have」· M 代码 · 共 34 行
M
34 行
function[varargout]=vpower(varargin)%VPOWER Raises array to the specified power.%% Y=VPOWER(X,N) is equivalent to Y=X.^N;%% [Y1,Y2,...YN]=VPOWER(X1,X2,...XN,POWER,N) also works.%% VPOWER(X1,X2,...XN,POWER,N); with no output arguments overwrites% the original input variables.% __________________________________________________________________% This is part of JLAB --- type 'help jlab' for more information% (C) 2001, 2004 J.M. Lilly --- type 'help jlab_license' for details if strcmp(varargin{1}, '--t') vpower_test,returnendn=varargin{end};for i=1:length(varargin)-1 varargout{i}=varargin{i}.^n;endeval(to_overwrite(nargin-1)) function[]=vpower_testx1=[1 2; 3 4];x2=x1;ans1=[1 4 ; 9 16];vpower(x1,x2,2);reporttest('VPOWER', aresame(x1,ans1) && aresame(x2,ans1))
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?