Getting an illegal use of reserved keyword 'if', really not sure why

8 ビュー (過去 30 日間)
Rohan Kotecha
Rohan Kotecha 2019 年 12 月 25 日
回答済み: Steven Lord 2019 年 12 月 25 日
close all
clear all
clc
% First try of method using 1000 random values
% I will increase the number of values until:
% mean(y) = 1.0e+03 * 0.37 and std(y) = 1.0e+03 * 0.047
% Will increase in powers of 10
rng(0,'twister');
a = 47;
b = 370;
no_values = 1000;
y = a.*randn(no_values,1) + b;
stats = [mean(y) std(y) var(y);
if mean(y) ~= 1.0e+03 * 0.370 & std(y) ~= 1.0e+03 * 0.04;
no_values = no_values.*10;
end

採用された回答

Steven Lord
Steven Lord 2019 年 12 月 25 日
stats = [mean(y) std(y) var(y);
You forgot the closing bracket on the previous line of code.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSpectral Measurements についてさらに検索

タグ

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by